Help me understand if this logic is correct

  1. run a query
  2. get the output
  3. based on step 2, do some comparison and run another query and get the output
  4. if step 3 query has data, then repeat the process 1,2,3 (2 more times). even if still data is there, email the team

my steps :-

  1. run 1st query
  2. get the output
  3. declare a variable as i=0
  4. do the comparison and run the 2nd query if i=0(to know that this is running 1st time)
  5. check if data is present
  6. if i=1 and dt.rowcount>0, then repeat the steps 1-3 and increment i again
    then repeat the steps again

Kindly explain what is expected if Step 3 does not contain data. Assuming run should be stopped

Logic looks fine. But based on your steps - there is no end point if data is available even after couple of loops

  1. Create an integer variable i and assign the value as 0.
  2. Create a boolean variable - boolContinueRun and set value as True
  3. You can use a do while loop like below
  4. DO
    Increment i variable
    Run Query
    Get Interim Output
    Based on interim output - compare and get actual output
    If Output does not contain data OR i>4 (or the max loop expected)
    Set boolContinueRun =false

While (boolContinueRun=True)

1st run - step 2 will have data , based on that do the step 4
for 2nd run - if step 2 is not having data, stop the flow
else do for 3rd run the same thing - whatever output is there email to team

Create an integer variable i and assign the value as 0.
Create a boolean variable - boolContinueRun and set value as True
You can use a do while loop like below
Do
Increment i variable
Run Query
Get Interim Output
If interim output contains data
Compare and Get Output
Else
Set boolContinueRun=False
End If

             If i=3
                  Send Email provided Output Contains data
                  Set variable boolContinueRun=False
            End if 

While (boolContinueRun=True)

Please check this

interim output means step 4?

I mean Step 2 - Which you are utilizing for Steo 4

@Shilpa_Mohanty

simple would be to use a if condition with currentquery.rowcount=0 OrElse counter=4 …in then end the process …on else do your steps of comparision

cheers