Loop Operations
This section covers how looping functionality can be used in RDA pipelines under AIOps Studio
1. Timed loop
Step 1: Create an empty timed_loop_example_1 using AIOps studio as shown in the below screenshot

Step 2: Add the following pipeline code/commands into the above-created pipeline as shown in the below screenshot:
You can copy the below code into your pipeline and execute that in your environment.
###### Pipeline for timed loop: Sleeps 'interval' seconds after each iteration.
###### if the max_iterations is specified, loop will stop after max_iterations reached
###### each iteration as variable loop_index set (starts at 0 and increments by 1)
@c:timed-loop interval = '3' & max_iterations = 10
--> @dm:empty
--> @dm:addrow message = "This is row number ${loop_index}"
--> @dm:save name = "temp-df-${loop_index}"
--> @c:new-block
--> @dm:concat names = "temp-df-.*"

Step 3: Click verify button to verify the pipeline. RDA will verify the pipeline without any errors (as shown below)

Step 4: Click execute button to execute the pipeline. RDA will execute the pipeline without any errors (as shown below)

RDA executes a looping-based pipeline and prints the loop details as shown in the above screenshot. During each iteration/loop, the pipeline screen updates the iteration number as shown in the above screenshot.

After iterating through max_iterations, pipeline data is stored in output and exits.
Step 5: Verify the data after the timed loop operation is completed as shown in the below screenshot (data is printed for 10 iterations in this example).

2. Count loop
Step 1: Create an empty count_loop_example_1 using AIOps studio as shown in the below screenshot.

Step 2: Add the following pipeline code/commands into the above-created pipeline as shown in the below screenshot:
You can copy the below code into your pipeline and execute that in your environment.
###### Pipeline for count loop: starts with 'start' number and increment by using
###### 'increment' until the value is greater then equal to 'end' variable
###### value for the each iteration is set as 'loop_index'
@c:count-loop start = 0 & end = 10 & increment = 1
--> @dm:empty
--> @dm:addrow message = "This is row number ${loop_index}"
--> @dm:save name = "temp-df-${loop_index}"
--> @c:new-block
--> @dm:concat names = "temp-df-.*"

Step 3: Click verify button to verify the pipeline. RDA will verify the pipeline without any errors (as shown below)

Step 4: Click execute button to execute the pipeline. RDA will execute the pipeline without any errors (as shown below)

RDA executes a loop-count-based pipeline and prints the loop details as shown in the above screenshot. During each iteration/loop, the pipeline screen updates the iteration number as shown in the above screenshot.

After iterating till 'end', pipeline data is stored in output and exits.

Last updated