How to edit scripts

The JavaScript check box on the Procedure window enables you to toggle between using JavaScript or XpertRule scripting for the procedure.

This section describes the mechanics of entering and editing XpertRule Scripting.

The use of upper/lower case letters when entering command words is of no significance and purely for readability. However, note that variable names are case sensitive. Indentation of commands can also be used. Commands and variable names can be typed in manually, or entered via the icons and function keys shown below.

Multiple lines per command can be used for many of the command statements - such as ASSIGN, IF, WHILE, etc. The point where you split the lines is quite flexible.

Cut, Copy, & Paste can be used via the standard Windows keyboard equivalents:

Cut - CTRL+X or SHIFT+DEL

Copy - CTRL+C or CTRL+INS

Paste - CTRL+V or SHIFT+INS

Press this icon (or use the F5 key or CTRL+SHIFT+SPACEBAR) to call up the @commands list. Selecting an @command and pressing OK will paste the command at the current insertion point. Alternatively, you can see help on any particular highlighted command by pressing the Help button on the commands list dialog box. You can also move to command words in this list by typing in one or more letters of the first part of the name.

@commands can be pasted with a default template to indicate the correct syntax for that @command. e.g. when you paste in the Assign command this will appear:

@Assign <variable> = <expression>

You can then highlight the dummy template <variable> and use the variable icon (or F6) to replace it with the attribute or string variable which you require. Then continue pasting in any further variables and editing the <expression> as required. e.g. @Assign Total = Cost * Price

Because it is used most often, the @Assign command will always be highlighted in the list of commands by default. Therefore just pressing the @ icon (or F5) and then the ENTER key, will quickly paste in @ASSIGN. When the command list box appears, you can also just press the first letter of a command word to move up/down the list.

Pressing this icon (or using the F6 key or CTRL+SPACEBAR) brings the available variables (attributes, strings. etc.) in a list box. Highlighting a variable name and pressing OK will cause it to be pasted at the current insertion point. Variable/attribute names can be typed in manually but remember that this might increase the chance of simple errors - and variable names are case sensitive.

When using default 'template' @commands (created using the @ icon) in a command window, you can highlight any dummy template <variable> and use the variables icon to replace it with a selected variable from the pop up list box.

The ability to replace text with a selected variable can be used on any highlighted text in a command window. XpertRule will take account of any superfluous highlighted spaces, commas or @ characters automatically.

Syntax Highlighting enables procedures to be shown with colors used to highlight special text, such as @Commands, etc.

Tip - Showing other Objects in the editor window

In the procedure editor you can make objects appear highlighted, to show that you could just click in order to open them in another editor window. To do this, hold down the CTRL key down as you move the mouse around the editor window.

Command syntax conventions

Example Description
@Assign reserved command words are identified in the main body of this documentation by the prefix @ character
variable in the syntax, items in italic letters indicate place holders for parameters that you must supply
[variable] in syntax, items in square brackets are optional
{True/False} in syntax, items in braces require a choice to be entered from any one of the items separated by slash(s)