- 03 Jun 2022
- 3 Minutes to read
- Print
- DarkLight
Flow Control Actions
- Updated on 03 Jun 2022
- 3 Minutes to read
- Print
- DarkLight
Flow Control Actions
break
Skip to the end of enclosing loop or section.
Property | Value | Description |
label | expression, variable | the label of the loop or section to end (default: the nearest enclosing loop) |
# Should stop logging after 4
a = createArray()
i = 0
while (i > 10) {
i = i + 1
if (i == 5) {
break ()
} else {}
log(i)
}
clearLastError
Clears the last error message and code, setting them to undefined, otherwise the last error message and code are available until another error occurs. This action does not include any properties.
# The beginning of the Action Set
clearLastError()
forEach(record, records) {
# Iteration logic
}
# The remainder of the Action Set
close
Close a closeable resource (e.g. connection or iterator.)
Property | Value | Description |
closeable* | expression, variable | the closeable resource |
inputText = openDelimitedTextInput(...)
forEach(input,inputText) {
log("The first name for this record is: " + input["fname"])
}
close(inputText)
comment
Comment.
Property | Value | Description |
comment | text | the comment |
# This is a comment
if(a == b) {
# Comments can be placed anywhere in your Action Set
log(a)
} else {
# Even here
log(b)
}
continue
Go to the top of the enclosing loop
Property | Value | Description |
label | expression, variable | the label of the loop to continue (default: the nearest enclosing loop) |
a = createArray()
i = 0
while(i > 10) {
i = i + 1
if(i == 5) {
continue()
} else {
log(i)
}
}
forEach
Iterate through each item in a collection.
Property | Value | Description |
label | expression, variable | The label for the loop. May be referenced by break and continue actions. |
variable* | expression, variable | the variable to assign to an item from the collection at the beginning of each loop iteration |
collection* | expression, variable | the collection to iterate |
do* | text, expression, variable | the actions to perform for each item in the collection |
inputText = openDelimitedTextInput(...)
forEach(input,inputText) {
log("The first name for this record is: " + input["fname"])
}
close(inputText)
getLastErrorCode
If available, returns the numeric error code associated with the last error message. Currently, only the Database, LDAP, and AD adapters provide numeric error codes.
Property | Value | Description |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
code = getLastErrorCode()
getLastErrorMessage
Returns the last error message sent to the log of the currently running Action Set (including messages sent by log() with a level of "ERROR").
Property | Value | Description |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
message = getLastErrorMessage()
getNext
Get the next item in this iterator.
Property | Value | Description |
iterator* | expression, variable | the iterator |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
iterator = openGoogleAppsUserIterator(conn, true)
hasNext = hasNext(iterator)
while(hasNext) {
next = getNext(iterator)
log("next:" + next);
hasNext = hasNext(iterator)
}
close(iterator)
hasNext
Check if there are more items in this iterator.
Property | Value | Description |
iterator* | expression, variable | the iterator |
returnVariable | expression, variable | name of the variable to be assigned to the return value |
iterator = openGoogleAppsUserIterator(conn, true)
hasNext = hasNext(iterator)
while(hasNext) {
next = getNext(iterator)
log("next:" + next);
hasNext = hasNext(iterator)
}
close(iterator)
if
Conditionally perform actions.
Property | Value | Description |
condition* | expression, variable | The condition to evaluate. |
then* | text, expression, variable | the actions to perform if the condition is true |
else | text, expression, variable | the actions to perform if the condition is false |
outputText = openDelimitedTextOutput(...)
myRecord = createRecord()
setRecordValue(myRecord,"fname","Troy")
setRecordValue(myRecord,"lname","Moreland")
putResult = putTextOutputRecord(outputText,myRecord)
if(putResult) {
log("Text record output successful!")
} else {
log("Text record output failed!")
}
close(outputText)
return
End the action and return a value.
Property | Value | Description |
value | text, expression, variable | the value to return from the action - may be assigned to the return variable specified by the caller |
return "Hello,World!"
section
A way to group multiple actions together.
Property | Value | Description |
label | expression, variable | the label for the section - may be referenced by break and continue actions |
suppressTrace | boolean, expression, variable | suppress detailed tracing of the actions in the section |
do* | text, expression, variable | actions |
# Open Connections
{
sessionAD = openADConnection(Global.adHost, Global.adPort,
Global.adSSL, Global.adUser,<Password>)
sessionGoogle = defineGoogleAppsConnection(Global.googleDomain,
Global.googleUser,<Password>)
if(!sessionAD || !sessionGoogle) {
# --- Error making connections. Terminating process.
return null
} else {
}
}
while
Loop while the condition is true.
Property | Value | Description |
label | expression, variable | the label for the loop - may be referenced by break and continue actions |
condition* | expression, variable | the condition to evaluate at the beginning of eash loop iteration |
do* | text, expression, variable | the actions to perform for each loop iteration |
i = 0
while(i < 10) {
i = i + 1
}