Execute Subroutines
Verb: goSubs
Runs a dynamic list of subroutines based on their names, and new routines can be added during the execution of the command.
Syntax
goSubs --routines(List<String>)
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--routines | Subroutines | Required | List<Text> | List with the names of the subroutines to be executed.
The name of the subroutine is given when creating it, and the creation process occurs in the following ways: |
Example
Example 1: Two subroutines are created, "subroutineA" and "subroutineB", in addition to a list called "newSubRoutine". In this context, the Add to Collection command is used to add the name "subRoutineA" to the list, so that when using the Execute Subroutines command, this subroutine is executed. Note that, in the "subRoutineA" instruction block, the name "subRoutineB" is added, again by the Add to Collection command, to the "newSubRoutine" list, so that the "subRoutineB" subroutine is dynamically executed by the Execute Subroutines command, previously used.
defVar --name newSubRoutine --type List --innertype String
add --collection "${newSubRoutine}" --value subRoutineA
goSubs --routines ${newSubRoutine}
beginSub --name subRoutineA
add --collection "${newSubRoutine}" --value subRoutineB
logMessage --message "Execution of subroutine A started." --type "Info"
endSub
beginSub --name subRoutineB
logMessage --message "Execution of subroutine B started" --type "Info"
endSub
Example 2: After adding the names of the two subroutines (subRoutineA and subRoutineB), the list of subroutines in the Execute Subroutines command is informed. In this other context, the subroutines show the current time when they are being executed.
defVar --name subRoutinesList --type List --innertype String --value "[subRoutineA,subRoutineB]"
defVar --name currentDate --type DateTime
goSubs --routines ${subRoutinesList}
beginSub --name subRoutineA
getCurrentDateAndTime --localorutc "LocalTime" currentDate=value
logMessage --message "Current date of subroutine A: ${currentDate}" --type "Info"
endSub
beginSub --name subRoutineB
getCurrentDateAndTime --localorutc "LocalTime" currentDate=value
logMessage --message "Current date of subroutine B:${currentDate}" --type "Info"
endSub