Editing a Business Rule in Script Mode

You can edit the script of a business rule.

By default, you create a business rule in graphical mode using the Rule Designer to design the graphical flow of the rule. After you create and save a business rule, you can edit it in graphical mode or script mode. If you choose to edit it in script mode, you can return to editing in graphical mode later.

To edit a business rule in script mode:

  1. Open the rule.
  2. In the Rule Designer, in the drop-down next to Designer, select Edit Script.

    To switch back to graphical mode, in the drop-down next to Edit Script, select Designer.

    When you switch from editing in graphical mode to script mode, if the business rule contains shared components (such as formula and script components) or templates, the script of the business rule contains only references to the shared components and templates in the Script Editor. The complete generated script of the shared components and templates is displayed on the Script tab in the bottom pane.

    Note the following:

    • When you select Edit Script in an ASO rule, the script is automatically converted to Groovy. If you then save the rule, the script is saved in Groovy and cannot be converted back to graphical. To preserve the graphical formatting, select Save As and save the rule with the Groovy script with a different name.

    • When you select Edit Script in a BSO rule, the graphical rule is converted into script mode that is based on calculation script syntax. To convert the script to Groovy, selecting Groovy Script as the Script Type.

    • Do not use the following keywords when editing in script mode:

      • /*STARTCOMPONENT*/

      • /*STARTCOMPONENT:SCRIPT*/

      • /*STARTCOMPONENT:FORMULA*/

      • /*ENDCOMPONENT*/

      • /*STARTRULE*/

      • /*ENDRULE*/

      • /*STARTTEMPLATE*/

      • /*ENDTEMPLATE*/

  3. Edit the script as desired.

    Table 2-4 Options Available When Editing in Script Mode

    Icon Description See Also
    Show Line Number

    Hide Line Number

    Display or hide the script line numbers. Line numbers are displayed by default.  
    Insert Function Insert a function and its parameters

    Auto suggest is provided for functions. When you type the first few characters of the function, press CTRL+Space to display the suggestions. Select one of the suggestions, and press Enter to complete the function.

    Working with Functions
    Insert Cross-Dimensional Members Insert cross-dimensional members Adding Members and Functions to a Component
    Range of Members Insert a range of members selected from dimensions Adding Members and Functions to a Component
    Insert Variable Insert a variable Working with Variables
    Insert SmartList Insert a Smart List Working with Smart Lists
    Edit Template Edit a template Working with System Templates
    Comment

    Uncomment

    Show/Hide Comment

    Comment

    Uncomment

    Show/hide comment

     
    Format Code Format code

    When you Format Code, the lines of the script are grouped together and are indented, and blank lines are removed.

     
    Verify Syntax Verify syntax  
    Wrap Wrap the script so that long lines of the script that scroll off the page display on multiple lines on the same page  
    Code Completion On

    Code Completion Off

    Code completion on / Code completion off

    Enables or suppresses suggestions for completing the code

    For example, to initiate code completion, after you type FIX, type SHIFT + Space so Calculation Manager enters () ENDFIX for you.

     
    Replace Find and replace a text string in the script Searching for a Text String in a Business Rule Script
    Find Select whether to Match Case or Match Whole Word when searching for a text string Searching for a Text String in a Business Rule Script
  4. Click Save button.

Tutorial video:


Video icon
Reviewing Scripts