Explore Categories

 

 PDF

Procedural-General Related Actions

Action START SUB … END SUB

In evaluation mode, the dependent regenerations of UI elements are deferred till the function exit. In cases where it is desired to trigger regenerations based on the set of statements as and when they occur, one can enclose the statements within the START SUB – END SUB action block.

To articulate this better, let’s take the previous example, where the Variable is being accessed by a field. The following function, on a button press, changes the value of the Variable two times.

[Function : My User function]

01 : SET : My Variable : “First Value”

02 : SET : My Variable : ##MyVariable + “, Second Value”

In a normal scenario, as both SET actions are modifying the value of the variable, the field (dependent on this variable) would get re-valuated twice. However, the platform has the ability to do it only once during the end of the function by default, when the function is called in EVALUATION mode.

To change this behaviour to refresh the field twice, these two SET actions can be covered inside START SUB – END SUB as follows:

[Function : My User function]

01 : START SUB

02 : SET : My Variable : “First Value”

03 : SET : My Variable : ##MyVARIABLE + “, Second Value”

04 : END SUB

SUB ACTION

The purpose of this action is the same as START SUB – END SUB. The only difference is that this action takes an Action to be executed as a parameter. The former one encloses a set of Actions inside the block.

Following is the alternative of the previous code by using SUB ACTION, rather than using the START SUB – END SUB action block.

[Function : My User function]

01 : SUB ACTION : SET : My Variable : “First Value ”

02 : SUB ACTION : SET : My Variable : ##MyVariable + “, Second Value”

START XSUB … END XSUB

In execution mode, the dependent regenerations are handled as and when they occur. In cases where we would like to defer regenerations based on the set of statements, we can enclose the statements within the START XSUB … END XSUB block.

Let’s take the following example to demonstrate this:

[Field : My Field]

Set as : $Value1 + $Value2

;; field value depends on the Value1 and Value2 of the current object

[Function: ModifyCurrentObj]

01 : SET VALUE : Value1 : “Somethi n g else”

02 : SET VALUE : Value2 : “Another value”

This code would normally cause the field to be re-evaluated twice during the function execution. However, enclosing it in an XSUB block would convert it into a single re-evaluation as below:

[Function : ModifyCurrentObj]

01 : START XSUB

02 : SET VALUE : Value1 : “Something else”

03 : SET VALUE : Value2 : “Another value”

04 : END XSUB

 XSUB ACTION

The purpose of this action is the same as START XSUB and END XSUB. The only difference is that this action takes an Action to be executed as a parameter. The former one encloses a set of Actions inside the block.

Following is the alternative of the previous code by using XSUB ACTION, rather than using the START XSUB … END XSUB block.

[Function : ModifyCurrentObj]

02 : XSUB ACTION : SET VALUE : Value1 : “Something else”

03 : XSUB ACTION : SET VALUE : Value2 : “Another value”

 

 

 

Post a Comment

Is this information useful?
YesNo
Helpful?