Editing Scripts

All the areas in which you can enter scripts support the usual text editing assistance such as color syntax highlighting, content assist and error markers. For example, if you want to specify a data field called Field, enter the character "F", then press Ctrl + Space. All matching data fields are displayed:

Note:
  • Content assist is case-sensitive. For example, it would differentiate between the class Date and a variable called date.
  • For arrays and multiple-valued items, content assist displays only the item name; it does not prompt for any indication of the multiple values.

You can then select the desired data field from the list and continue entering JavaScript:

In this case there is an error marker next to the line. This is because validation has reported an error in the Problems view. TIBCO Business Studio provides validation for the JavaScript syntax.

You can position the cursor over the error marker to display the reason for the error:

When these errors are corrected, the error marker and the corresponding entries in the Problems view are removed.

Content assist also provides templates for common JavaScript constructs. For example, if you enter if, then press Ctrl + Space, you can use the following template to construct an if else construct:

Note: When using the colon character in a JavaScript conditional expression, ensure that you insert spaces before and after the colon. For example, the following expression is not valid:
   FIELD2==4?PARAM1:PARAM2;

The corrected expression is:

   FIELD2 == 4 ? PARAM1 : PARAM2;

Content assist similarly provides prompting for the properties of common data types and for data type conversions, as in the following example where the user has selected content assist after typing Number.

(See ’Script Functions’ in the Business Data Services Guide for details on data type transformations supported.)

Additional Functions

Some additional methods compatible with standard JavaScript are provided with BPM and can be used in the scripts that you write within TIBCO Business Studio. These are described in ’Script Functions’ in the Business Data Services Guide.