Skip to main content

Get help for ARIS Process Mining functions and services

Use the code editor

The code editor provides you the ARIS process language to create simple operations, such as reading values from a particular field, or any complex arithmetic operations.

For a list of provided operators and operands, see the Scripting operators and operands chapter. To display all supported operators and operands in the editor, click the first line of the editor and press Ctrl + Space. A box with the supported elements opens.

Tip

You can insert a comment line in the code by using the # character. Everything between # and end of line is a comment, for example,

...

# this is a comment.

...

The following example illustrates the basic procedure for creating a calculated field using the code editor.

Example 137.

This example shows how to create a field that contains the values of the time span between the Create Purchase Requisition and Create Purchase Order activities of a case. The example is the same as described for the visual editor.

The examples are based on the demo data provided by ARIS Process Mining. You can use the demo data to follow the examples.



Procedure. Procedure
  1. Click the first line of the code editor.

    Code editor
  2. Add the TO_LONG convert operator to the calculation rule. Given that the time span cannot be calculated with values of the date type, the date must first be converted into a number.

    1. Enter the name of the operator in the editor. A panel opens containing a list of operators corresponding to your input.

    2. Use the arrow keys to navigate through the list.

      Add aperator
    3. Select the TO_LONG () operator. The TO_LONG() operator is added in the first line of the code editor and a preview of the corresponding data is displayed.

      Add operator
  3. Add the ACTIVITY_PU_FIRST operator that reads the activity fields.

    1. Place the cursor between the parentheses of the TO_LONG() operator.

    2. Add the ACTIVITY_PU_FIRST operator. The operator pulls up the value of the first matching field. It has the following syntax: ACTIVITY_PU_FIRST(field: Field, filter?: Boolean).

      Add operator
  4. Specify the activity field to be read by the operator. Replace the field operand by the Activity start time field. The Activity start time is a standard field automatically created for the analysis model. Standard fields have the _ARIS. prefix.

    Select the field operand of the ACTIVITY_PU_FIRST operator and enter "_". A list with all standard fields starting with "_" is provided. Select the _ARIS.Activity.Activity start time field.

    Specify field

    The selected field replaces the field operand.

    Field added
  5. Add the Create Purchase Requisition activity as filter value to specify the activity whose start time is to be read.

    1. Add the name of the activity as the second field. Multiple operands are separated by a comma (,).

    2. Enter " to add a field as operand. A second " is added automatically. Fields and objects are enclosed in quotation marks.

    3. Place the cursor between the two quotation marks "".

    4. Enter "_". A list with all standard fields starting with "_" is provided.

    5. Select _ARIS.Activity.Activity name as second field.

      Second field
    6. Add the Create Purchase Requisition activity as filter value as follows: "_ARIS.Activity"."Activity Name" = 'Create Purchase Requisition'

      Values are enclosed in single quotation marks.

      Add filter
  6. Press Enter. A second line is added.

  7. Enter - (minus).

  8. Press Enter. A third line is added.

  9. Define the operation to calculate the start time of the Create Purchase Requisition activity. The procedure is the same as shown above.

    Complete operation
  10. Click Add.

You created an operation for a new calculated field. The field is added to the selected object in the Model panel.

You can create parameters for use in your calculation rule.

Example 138.

The new calculated field is added to the Activity object.

New calculated field