Micro Focus QTP (UFT) Forums
Repeat iterations Until New Value Is Seen in Column1 - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Repeat iterations Until New Value Is Seen in Column1 (/Thread-Repeat-iterations-Until-New-Value-Is-Seen-in-Column1)



Repeat iterations Until New Value Is Seen in Column1 - shayk1985 - 06-30-2018

Hello,

I'm importing an excel that has 2 columns (Column A and Column B). 
I'm trying to put a logic for my UFT script to repeat iterations by taking values from Column B until the value in column A changes.

Loop condition: Take value from Column A
   Repeat iterations by taking values from Column B until the value in column A changes.
End Loop

Part of script
1. Login to a specific location by taking the value from column A
2. Repeat steps for n number of rows in column B until value in column A changes

column A, Column B
001, 2001
001, 2002
001, 2003
001, 2004
002, 2001
002, 2005
002, 2006
003, 2002
004, 2004
004, 2005
004, 2006
Thanks in advance. Appreciate your help in this matter. 

Regards,
Shayk


RE: Repeat iterations Until New Value Is Seen in Column1 - Ankur - 07-05-2018

First , please refrain from posting duplicate questions on the forums. We have deleted the first question this time.

Here is the algo you can try -

  1. Start the loop for ColA
  2. Store the value of column A in a variable say strColA
  3. Start a loop for ColB
  4. Compare the strColA for the current values of ColA, say tempColA on every iteration. 
  5. As soon as strColA is not equal to tempColA, exit the ColB loop.
  6. Now your loop of ColA will repeat 1-5 till it process each row for ColA.