Versions Compared

Key

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

Introduction

The JS7 - If Instruction is used for the conditional processing of orders. It evaluates the return code, can be used for example to evaluate the return value of the a previous job , and the order variable within the workflow. if-instruction allows using the else instruction optionally. If due to any reason the if-instruction fail the else will execute. In the workflow jdConditionalResult, two If-instruction is used first If-instruction has and it can be used to check any order variables. 

The If Instruction allows users to declare conditional processing at the configuration level and leverages the need to apply scripting that buries the conditional logic in the script code.

Workflow

In the jdConditionalResult workflow two If Instructions are used:

  • The first If Instruction uses the expression $return_value_job1.toNumber == 0. With this predicate, if

...

  • the job's return_value variable is equal to 0 then the If

...

  • Instruction evaluates to true. This If Instruction is used to either run job2 or to run job3 depending on the evaluation result.
  • The expression used in the second If

...

  • Instruction $return_value_job.toNumber >

...

  • 0 triggers if the predecessor job's return_value

...

  •  variable is greater than 0

...

  • . In this case the If Instruction evaluates to true and

...


To execute the workflow in from the folder 07_ConditionalExecution please follow the steps described below steps:

  1. Click on the folder 07_ConditionalExecution from the and and expand the jdConditionalResult workflow.




  2. To add the order in Click the workflow . Click on the action menu of the workflow and click onand use the Add orderOrder button menu item from the drop-down menu to add an order to the workflow.



  3. On clicking the When clicking Add Order. A  a popup window will appear. 
  4. You can add the an Order ID or leave the Order Id ID value blank empty, it will take the default Order Id to process the Orderthen use a default Order ID. Click the Submit button.
  5. With the help of  Modify Variable button, link you can edit the value of the variable variables assigned to the workflow.



  6. Click on the the Modify Variable and  link and select the name of the variable name that you want to modify from the drop-down menu. e.g; I have selected the variable  In the screenshot below, the return_value_job1  variable has been selected and the default value is 0. Here the variables are already declared you can change it according to you and click on Submit button to add the Order in a The variable is declared with the workflow definition, you can modify its value and click the Submit button to add the order to the workflow.




  7. To check the status of the Order order click on the Workflow name with this new Order history panel will appear. name of the workflow to make the Order History panel appear.




  8. From the Order history History panel, you can see verify if the Order order is successful and  hasfinished. Click on the Order ID to open the detail logs of executionsee log output created by the jobs executed for this order.




  9. A log window will open and the order log will be displayed. The order log contains log output from all contains output to stdout/stderr from all jobs executed by the order. 
  10. You can download the log file by clicking the Download button from in the upper right-hand corner of the log view window. Also, you can expand and collapse the individual all job output using the arrow button from the left chevron icons in the upper left-hand corner of the log view window.