stdout: ExecuteOutput,
exit: Error = execute(
"/some/command/path -with arguments",
host: "_AAE_"
)
if Error then
log.error("command exited with non-zero exit code")
else
log("execute returned ${ExecuteOutput}")
end
Table of Contents
Avoid using if constructs for large algorithms in a single KI. Please see the Logical Branching section for more information.
|
Definition
if allows conditional execution. It contains a condition to be evaluated first. If the condition is true, the then block gets executed. Otherwise if the condition is false, the optional else block gets executed.
Usage
The if block will check the exit code of a command:
Example
The following example will check the numerical exit code of a command:
if LOCAL::CODE == "0" then
persData = "extracted"
delete(GetPersonData)
else
persData = "failed"
log("failed to get data for Person: ${persNo}")
end
You can also use "and" and "or" to consider multiple conditions within a single if block.
if LOCAL::CODE == "0" and LOCAL::Status == "SUCCESS" then
persData = "extracted"
delete(GetPersonData)
end