CheckLoopCount

You can use this function for Optiva Workflows.

Purpose

Allows looping, or a repeat of action steps, during a workflow.

Syntax


Dim variable As Integer = CheckLoopCount()

Arguments

None.

Typically, at least one argument for a function statement is required by the system. The argument for this function is not used.

For this function, use a conditional statement to indicate the number of times the workflow can loop.

Indicate on the Action Set form the action to which the workflow loops. In an Action Set, you can choose any previous line as the Loop Line, regardless of how complex the Action Set is. There are no restrictions on branched or nested steps.

Action sets can contain multiple loops. You can loop backward, but never forward.

If a task within a looping group has been skipped, then the task will remain in a skipped state.

Note: Include only one loop per action.

Description

Use CheckLoopCount and its return code, 811, to repeat actions in a workflow for a specified number of times. Or, use it until a satisfactory response is reached. This function is most appropriate for the Return event.

Examples

In this example, the lab manager returns the workflow to the technical director up to three times. This script is assigned to the RETURN event. Each time the lab manager clicks Return, the workflow returns to the action that is assigned to the technical director. After three returns, if the lab manager clicks Return, the workflow cancels.


Dim iLoopcount As Integer = CheckLoopCount()
if (iLoopcount <= 3) then
   MessageList("Returning to the technical director.")
   Return 811
else
   MessageList("Workflow cancelled.")
   Return 9111
end if

Open the Action Set form. In the line that contains the CheckLoopCount function, add the Line ID to the destination line in the Loop Line column.

In this example, the CheckLoopCount function is in the second action. The value of 1 instructs the workflow to loop to the action in Line ID 1.