AutomationEdge Core: Looping

AutomationEdge Core: Looping



AutomationEdge Core: Looping

This plugin has steps for implementing loop in workflows.  The steps to implement a loop are described below. The descriptions below specify the design to implement loops in workflows.

Loop Start and Loop Continue steps execute as a pair. If you drag and drop Loop Start Loop Continue is automatically dropped. The two steps in pair have the same color. If any other pair is dropped in Process Studio it will have a new color for the pair.


Break Loop

Description

Break Loop step breaks the current loop iteration based on certain conditions, independent of start Loop conditions. 

The Break step can be executed in between the loop. This step is internally attached to one specific Start Loop Step and can break only the relevant loop attached to it.


Configurations 

No.

Field Name

Description

1

Step Name

Name of the step.  This name has to be unique in a single workflow.

2

Loop Name

When Break Step is dropped on canvas a dialog pops with loop names.  Choose a Loop name to which the Break Loop step is to be associated.


Note:

  1. When Loop Start or Loop Continue is deleted the relevant Break Loop Step is also deleted.
  2. All break steps should have incoming hops from the steps connected to relevant Start Loop Step.
  3. If Break Loop step is deleted from the workflow relevant Loop steps are not deleted.



Start Loop

Description

This step marks begin of loop execution. 

Single Threaded: The steps in the loop will be executed as a single thread. The other input rows are paused until a continue signal is received from loop continue step. 

Input Row: The same input row is passed for each iteration of that particular row. Additional fields can be added to this input row, which would be populated during the loop iteration and available after the loop iteration. 

All other fields generated by steps during loop iteration will be destroyed i.e. their scope would be valid only for that particular iteration. 

Loop Condition: A dynamic condition block will be provided. This can be used to construct simple as well as complex conditions. Based on the output of this condition, the input row will be routed to either continue (in case of condition failure) or end the loop (in case of condition success).

Implicit Counter:  The user can provide a counter name and number of iterations for which the loop would execute. 

Output Hops: There will be two output hops, for ‘true’ and ‘false’ condition. It is mandatory to have Loop Continue at the end of true path.


This step has the following user inputs as shown in the screenshot and configuration table below,

  1. Counter Name
  2. Loop iteration count
  3. Dynamic Conditions block
  4. Table for Additional field names





Configurations 


Figure: Start Loop Step UI


No.

Field Name

Description

1

Step Name

Name of the step.  This name has to be unique in a single workflow.

2

Loop Name

A Loop Name generated automatically.

3

Conditional Loop?

Enable check box if you want to loop based on a condition.

If enabled Iterator name below is disabled.

4

Iterator Name

This field is enabled Conditional Loop above is not checked. Provide an iterator name.

5

Number of iterations

Provide an integer value for number of iterations for each row.





Table: Additional Fields1 

This table is used to create user defined additional fields. Additional fields are added as columns to the row. They are permanent and visible even after the loop is over.


Note: Any fields created within a loop are not permanently available after loop execution. Only Additional fields specified in Loop Start are available even after loop execution.

1

Name

Provide names of all additional fields you want to define.

2

Type

Select a data type for the additional field.

3

Format

Select a format for the data Type selected above.

4

Default value

Provide a default value for the additional field.

5

Set empty string?

Select Y or N.

If default value is not provided set ‘Set empty string?’ to Y. This sets a null value as an empty string.





Block: Conditions

Conditions Block is a set of five fields. These fields can be populated with Previous field, Addition fields or Static values.  Click the field to populate a value as a toggle or from a popup that comes up. 

The first field specifies a toggle for a condition. Leave it default to blank or click once to toggle it to NOT.

The second is the field to compare.

The third field is an operator

The fourth field is the field to be compared against or alternately specify a static value in the sixth field to be compared against.


Click on the small rectangular icon on the right hand side of the block to add a condition. You can Add a condition with the following operators: OR, AND, OR NOT, AND NOT, XOR.

Multiple condition list by icon on right side 


Right click on a condition to get a pop-up menu with the following options: Edit condition, Delete condition, Add sub-condition, Move condition to sub-condition (-->), Move condition to parent (<--) and more copy options. These options can be used to create Nested conditions.





Button: Get Fields

In the Conditions Block above only previous fields are available. Click Get Fields to make Additional fields also available in the conditions block.




  1. Conditions Block Description

  1. The first field is a Boolean and value can be set to null or NOT.  This field acts like a toggle field and changes values upon click. The possible values are null or NOT.
  1. Null Condition



  1. NOT condition




  1. In the second field User defined Additional fields can be selected. 




  1. In this case ‘a’ is selected and is assigned a value 2. It can also be assigned a field value.





  1. Multiple conditions can be added using the Add condition on the right. 


  1. In the snapshot below the first condition has been added and ready to add the second condition. Click on the null condition to populate it.


  1. In the third field select operational functions.



  1. In the fourth field previous step fields or Additional fields can be set. Values can be set either in the fourth step or in the fifth fields. 




  1. In the fifth and final field provide a static value along with conversion format. 



Continue Loop

Description

Loop Continue step is created automatically with a Loop Start step. 

This step continues to loop start step for further decision making. It will only contain the loop start step name. All the additional generated fields will be passed. Also the counter is incremented before the row is forwarded.


This step needs the following user input as listed in the Configurations table below,

  1. Loop Start step name


Configurations 

No.

Field Name

Description

1

Step Name

Name of the step.  This name has to be unique in a single workflow.

2

Loop Name

It automatically picks up a loop name based on the Loop Start step it is connected to.

3

Button: OK

Click OK button to accept configurations.

4

Button: Cancel

Click CANCEL button to discard configurations.


Schematic representation of a Workflow with Loops










Sample Workflows: Simple Loop

Following is a demonstration to create a Simple Loop workflow.

  1. Create a new workflow and save it as SimpleLoop.
  2. Add a Data Grid step with meta data as shown below.


  1. Add data in the data tab. 
  2. Click Preview button to view the records.


  1. Always Drag and Drop Start Loop Step or double click Start Loop. When you do this automatically a Continue Loop step is also created for you in Process Studio. These steps always exist in combination.



  1. Add a Modified Java Script step between Start Loop and Continue Loop. Whenever you create a Hop from Start Loop it is terminated with ‘Condition: TRUE’ or ‘Condition: False’. No Hops are allowed from Continue Loop. 


  1. Join Modified Java Script to Continue Loop as shown below. 




  1. Configure Start Loop. All the fields of Start Loop have been explained in the Configurations table.

In this example we do not have a condition, instead we have created an iterator ‘addition’ with number of iterations for each row equals to 1.










  1. Configure Modified Java Script as shown below to add two field values.


  1. Leave Continue Loop configurations as it is or alternately specify a Step name. 
  2. Add a Text file output step. Draw a Hop with Condition: FALSE. This completes creating both Condition: TRUE and Condition: FALSE Hops.



  1. This is the complete workflow. You can now run the workflow. 


This workflow introduced you to how to use Loop step in a workflow.






Sample Workflows: Nested Loop 

Nested Loop can be considered as a loop in a loop. The following picture depicts a Nested Loop. In the screen shot the parent loop steps are ‘Start Loop’ and ‘Continue Loop’ as seen below. The child workflow steps are ‘Start Loop2’ and ‘Continue Loop2’.



Validations for Workflow with Loop steps

  1. If the workflow is using switch case for path decisions inside loop or error handling, all of them must end with Loop Continue Step.
  2. Both the steps must be present and connected properly in the workflow.
  3. Infinite loop will not be verified.
  4. Cannot have Blocking Steps in the loop
  5. Steps like Merge Join, Join Rows which wait for all rows before execution start will not be allowed in the loop. 
  6. Row generating steps like Microsoft Excel Input are not allowed in a loop. However, Web Loop Table is allowed in a loop.
  7. The following steps are also not allowed in a loop, Identify last row in a stream, Send Email, Intermediate Status and Exit Browser 



Sample Workflows: Break Loop 

Nested Loop can be considered as a loop in a loop. The following picture depicts a Nested Loop. In the screen shot the parent loop steps are ‘Start Loop’ and ‘Continue Loop’ as seen below. The child workflow steps are ‘Start Loop2’ and ‘Continue Loop2’.



Validations for Workflow with Loop steps





      Links to better reach 

            Bot Store

             EPD