Designing a Script Component

Script components can be used in business rules and templates. You create a script component from the System View or any of the other views. You can also create a script component from within the Rule or Template Designer while you are designing a business rule or template.

Note:

You can also design a script component from within a business rule or template.

To design a script component:

  1. In System View, right-click Scripts, and then select New.
  2. Enter a name, application type, application, and plan type for the script.
  3. Click OK.
  4. Use the icons to design the script component.

    Note:

    Unlike rules, templates, and other components, when you open a script, you cannot view it in a graphical format (within a flow chart). You can view it only in script format.

    You can do any of these tasks with the script:

    • Click the Hide/Show Line Numbers icon to hide (or display) the script line numbers. Line numbers are displayed by default.

    • Click the Insert a function and its parameters icon to insert a function into the script. See Working with Functions.

    • Click the Insert members selected from a dimension icon to insert a member into the script. See Adding Members and Functions to a Component.

    • Click the Insert a variable icon to insert a variable into the script. See Working with Variables.

    • Click Insert smartlists to insert a Smart List into the script. See Working with Smart Lists.

    • Click the Comment and Uncomment icons to add and remove comment lines from the script.

    • Click the Hide Comments icon to hide the system-generated comments in the script.

    • Click the Verify Syntax icon to check the syntax of the script for errors.

      Note:

      If there is a syntax error, the code containing the error changes to red text, there are no error messages displayed. If there is not a syntax error, the message, "No syntax error(s) found," is displayed.

    • Click the Wrap icon so that any long lines of the script that scroll off the page display on multiple lines on the same page.

    • Click the Set Code Completion Off icon to suppress suggestions for completing the code. (This icon functions as a toggle. To turn code completion back on, click the icon again. By default, code completion is set to On.)

    • Click the Replace icon to find and replace a text string in the script. See Searching for a Text String in a Business Rule Script.

    • Click the Find icon to find a text string in the script. See Searching for a Text String in a Business Rule Script.

    • Enter search text in Find, and click Previous or Next to find the previous (by searching up in the script) or next (by searching down in the script) instance of the text.

    • Enter a line number in Go to Line, and click the arrow to highlight the line number in the script.

    • Expand or collapse a line in the script by clicking the plus or minus sign to the left of the line. For example, FIX statements display with all of the lines in the statement displayed by default, but you can hide the lines of the FIX statement by clicking the minus sign to the left of it.

    • Select the lines of the script to copy, and click the Copy to Clipboard icon.

    • Select the lines of the script to cut, and click the Cut to Clipboard icon.

    • Place the cursor in the location of the script where you want to paste, and click the Paste from Clipboard icon.

    • 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 click or press Enter to complete the function.

  5. On Properties, complete these steps:
    1. When you create a script component, Shared is not selected. To make the script component shared, select the Properties tab, select Shared, and type in a name.

      When you create a script component from the System View, Shared is selected by default, and you cannot change it. If, instead, you want a copy of the script in a business rule, drag the shared script into the business rule, then clear the Shared check box on the Properties tab. This creates a copy of the shared script in the business rule; the copy of the shared script is not changed if the shared script is changed. When you save the business rule, the script no longer has a name.

    2. Optional: Edit the script's name by entering a new one of up to 50 characters. (The name defaults from the New Script dialog.)

      Note:

      You can only name a shared script. If the script is not shared, you cannot type in the Name field.

    3. Enter a description of up to 255 characters for the script.
    4. Enter a caption for the script. The caption is displayed below the script in the Rule Designer and Template Designer flow charts.
    5. Enter comments for the script. For example, you may want to tell users what the script should be used for.
  6. On Script, enter a caption for the script component.
  7. Users creating a script component for a template only: Select Use Design Prompt if you want to use a design-time prompt in the script component. Then in the condition grid, define a condition for the design-time prompt by performing these tasks:
    1. In DTP, select a design-time prompt.
    2. In Operator, select an operator: = = or <>.
    3. In Value, use the dropdown list to select a value. You cannot type in this field.
    4. Repeat these steps to create as many statements in the condition as you need.

      Tip:

      Click the plus (+) and minus (-) icons to add and delete rows from the grid.

  8. Users creating an independent script component (that is, a script component that is not within a business rule or a template) or a script component for a business rule only: On Usages, you can view the rules that use the script component.

    Note:

    You cannot edit any of the information on this tab.

  9. Click Save button.