Dear ,
There is one idea that might help ur solution ,
u could create nested loop as a workarround in k2 ,
Create unbounded Event and call it "table2 loop" , and add condition for all items in table 2 -> execute "anything"
after that , on ur same first screen shot , when ur button is clicked , for all items in table 1 =>execute "anything" and to trigger the nested loop u go to actions and search for "another" , u will find a rule named "execute another rule" and u will find the unbounded rule u added before "the loop that goes through table 2",
In this way u will have table 1 loop and table 2 loop nested inside of it ,
Hope it helps!
Regards.
Thank you Ahmad U Rock that did the trick !!!
It worked perfect as expected !!!.
THX Again Dino.
Just to make sure leave the post with the correct solution here we go.
Fact:
So we have 2 SMO's. Each SMO have a list of computers. The idea is to match Table1 or SMO1 with Table2 or SMO2.
Requirement:
If some of the ComputerName listed on SMO1 does not exist in SMO2. need to be detected and inserted into SMO2. and some Message, Alert, conceivable workflow or something else could happen.
Challenges
With 2 SMO's is necesary to create a ForEach Loop trough the list. K2 is able to achieve this via Unbound Rule and call it from the first ForEach Loop.
Is necesary to identify once the second nested loop finish if it was a match with the ComputerName from first item from SMO1. S Wee need a counter !!! ]
Using Params as Temp Variables
I decided to use parameters as variables durin runtime and assign values while they are running in the loop.
The end result, is after the second loop complete if there was a match an incremental +1 counter will have a value if the counter is "0" then means there was no match on the SMO2 and something will be executed.
Here is how my Parameters look like:
The first Rule of Transfer Data basically initilize the myparam with the name of the ComputerName p This was just for testing really not required for this example ]
Later execute mysccmcount transfer with an Expression called mysscmAddOne, which basically is an expresion to increment the value of this parameter, since originally was setup default to "0" will turn into 1 at first and everytime the loop goes trough this, will increment and we will have the value of the loop cycle.
So basically the expression takes the same variable and increment on 1 and that is the execution on transfer data within the loop.
So once we start the main loop transfer data to myparams and continue starting the nested loop 2. if we look the rules for the second Loop:
Since we just really care if there is a missing field... the condition check for mycounter=0 that meand there was no match trough the nested loop. something needs to happen:
A popup message display what is missing
A create method to SMO2 is performed to normalize the data between the two tables
An email is trigered.
s NOTE: Potentially here you could start a workflow or something else ]
This concept work fine. I have not perform any stress testing, because what happen if I have 50,000 entries within SMO1. How long will it take to loop trough all of those.
I'm loading 2 views at once... could not find a way to execute the loop directly from the SMO. potentially could be an expensive process if there are to many records in the SMO1 and SMO2. not sure if this could be put in the background in case takes hours to run, this to avoid to much stress within the K2 Server or kind of put in the background with low priority to be resourceful.
But again for a few records should be fine. just wanted to update this post, because regarding my first question yes is possible to create a nested loop with K2 and find some matching records.
Have Fun Dino.