User Method Expressions

User methods are custom pick actions—specifically customized menu options (pick actions) that you can associate with any database item (see Using the User Methods Tab to Define Custom Actions in the ClearSCADA Guide to Core Configuration).

You enter a user method expression in the Method field (User Methods tab) on the item's configuration Form.

The following syntax is an extension of the grammar for Method Expressions:

<user-factor> ::= <factor> | <prompt>

<prompt> ::= "[" <string> "," <expression> "]"

Where:

<user-factor> replaces <factor> in the definition of <term> (see Standard Expressions ).

The grammar includes an additional type of factor called a prompt. This allows you to request that the user enters a value when the pick action is executed. A prompt consists of 2 parts:

  1. A string that is used in the pick action's window as a label for the value.
  2. A default value. This is the value that is selected by default when the pick action's window is displayed. It also defines the type of value that the user is prompted to enter.

When the prompt factor is evaluated, it returns the value entered by the user.

Example:

User methods are often used to prompt a user to enter some values for a Logic program. For example, the following expression calls the 'Execute' method on a Logic program:

Execute( ['Number', 10] * 5, ['String', 'Closing'] )

The expression defines that there are 2 arguments for the method, one is a number and the other is a string. The default setting for the number is 10 and the default setting for the string is 'Closing'

When a user selects the user method for the relevant item, a window is displayed. The window requires that the user enters an integer (number) and a string.

The integer value is multiplied by 5 and passed as the first argument to the Logic program, and the string value is passed as the second argument. The Logic program then uses these values in its calculations.

If the user does not enter a number and string, the default settings of 10 and 'Closing' are used.


Disclaimer

ClearSCADA 2017 R2