Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • The If Instruction evaluates an expression from a predicate and returns a boolean value Boolean value true or false.
  • Therefore Boolean algebra is applied, for example, to evaluate expressions such as $returnCode.toNumber == 0.
  • For details see JS7 - Expressions for Variables

...

  • Boolean values are represented by the keyword true, the keyword false or by a converted variable value
  • The keyword syntax with the predicate of an If Instruction is: true, false.
  • A variable value of data type "string" can be converted to a boolean Boolean data type with the the toBoolean method using the following syntax:
    • ${varName}.toBoolean
    • variable(...).toBoolean
  • (warning) If the variable value is not a boolean data type then the order fails with the If Instruction.

...



Explanations:

  • Return Codes come in two flavors:
    • for shell jobs the return code corresponds to the operating system exit code.
    • for any other job types the return code is provided by the relevant job indicating success or failure.
  •  The job definition specifies which return codes indicate success or failure:


     
    • For the above workflow example job1 considers the return codes 0,1,2,3,4 to signal success and any other return codes to indicate errors.
  • Therefore a return code > 0 does not necessarily indicate failure but can be used, e.g. for workflow control, to indicate which jobs should be executed next.
  • If a given return code is not present in the list of successful return codes then the order will be considered to have failed. However, if the return code is available in the list of successful return codes then an If Instruction can check the return code value and can continue with specific jobs if the If Instruction evaluates to true or to false.

...



Explanations:

  • Return values are different from return codes as they do not indicate success or failure of a job. Instead they return variables and values indicating the processing result of a job, e.g. the number of records from a database table that have been processed by a job.
  • Such return values can be used to implement conditional processing. An If Instruction can evaluate the rerelevant return value and determine what jobs to execute next.

...



Explanations:

  • Technically this use case is not too different from the checking return values use case described above. However, the focus is not on a specific job but on specific values of variables.
  • Note that order variables can be modified by users when adding an order. The above example therefore checks an order variable to decide which job a workflow is to be started for.
  • Note also that the same check can be performed for any step in a workflow.

...