' oicbasics: January 2022
January 10, 2022

While Loop in OIC | While Action | Oracle Integration Cloud

 

Knowledge :  đź‘€ 

While Loop? : Loop over actions or invoke connections as long as a specific condition is met. You define the condition for the while loop in the Expression Builder.



Lets understand the While Loop by the help of one Hands-on Practice. In Part 1 we will compare numbers and in Part 2 we will compare String in while loop expression builder.


PART 1 : 

Compare Numbers in While Loop | Oracle Integration Cloud :


Use case : lets develop one Schedule Integration using While Loop which will keep executing till the time a specific condition is not fulfilled (for ex :- condition is While Loop will keep running till the time Variable_B value > Variable_A value). Once the condition failed, while loop execution will get end.

STEP 1: Create one Schedule Integration.



STEP 2: Add Assign activity, give some meaningful name & then declare Two Variables (ex : - var_A and var_B ). Initialize the variables by assign values 1 and 10 respectively. (as shown in below image)





STEP 3: Add While Loop and give some meaningful name



    • Compare the variables as shown in below image 
Expression : number($var_B) > number($var_A)







STEP 4 : Now add one Assign activity inside the While Loop to keep increasing the Variable_ A value by 1 after each loop completion.



    • Build the expression to keep increasing the Value of Variable A (var_A) after each iteration. (take reference from below image )
                                               Expression : number($var_A) + 1.0





STEP 5 :  Enable the Tracking Variable (you can take reference from below image )






STEP 6 : Save the Integration & Activate the Integration.


STEP 7 : TESTING : - Submit the Integration for Testing.




      • Click on the Instance Id that got generated after submission to track the Flow.


      • Now Click on Start Time to check the Flow.




You can see it clearly While Loop executed 9 times and came out the loop when condition failed (i.e when var_A value became equal to var_B value.) This way we have successfully completed one While Loop POC. I hope this helped you to understand While Loop use in Oracle Integration Cloud.



PART 2 : 

Compare String in While Loop | Oracle Integration Cloud :


Note : To compare String using While Loop you can use contains function (as shown in below image ). You can't simply compare two string in while loop expression builder. It will Error out.


Thank You !
Top