ForEach problem

Hi,

How do I go to next line (1, then line 2, then line 3) using this For Each Loop ?
Beuause it just ho back to first line in the loop.

Appreciate anyone could help.

Thank you.

AP.

Hi @apeterg

Can you share the selector in UI explorer for the TypeInto activity.

Check out the document and thread

Regards
Gokul

Hi,

Pls find below screen shot

Thank you.

AP.

Hi,

I will try to explain you the simple general approach to such type of issues. All the below operations needs to be performed under for each loop.

  1. First try to take the whole web table in an datatable variable.
  2. Next find the total number of rows available in this table by using Int_Datatable_Row_number = Datatable.Rows.Count.
  3. Now declare one Int variable name as Int_Counter and initialize it to “0”.
  4. Now Grab the selectors of the live web table on the screen, there just put wildcard (*) in place of the “parent ID” and counter value in place of the “row table1”. In this way your BOT will be getting the instructions about the selectors, row numbers.
  5. Just below this above operation Use If condition to validate the Int_Counter is greater than Datatable row count. If yes then Just put BREAK activity inside it , so eventually it will terminate the For each Loop. If no then just keep the other part of IF statement blank.
  6. Finally Outside the IF Activity Increment the Int_Counter value by 1.

If this solution sounds good to you please mark it as “SOLUTION”.:slight_smile:

Thanks.

Hi @apeterg

  1. Use Assign activity → Variable (Int)
Count = 1

Use For each row activity

  1. Use Type into activity → pass the variable instead of the Tablerow=‘1’ to Tablerow=‘Count’ (Check the document or thread how to pass the variable inside the selector)

Check on the above post for dynamic selector

  1. After Typing the first text go for next one
  2. Use Assign activity
Count = count+1
  1. It will loop through for all the cases in the for each row

Regards
Gokul

a several building blocks were already introduced .e.g dynamic selectors.

From your screenshot we do see that the population part is driven by a for each row acitvity.

The for each row activity has an output field called index which represents the current loop number.

So this information can directly be used for the dynamic selctor e.g.

assign Activity - within the for each row block:
strTableRowPart= (index + 2)

  • we refer to your screenshot TableRow=‘2’

and the dynmic selector could look like

<webctrl tableRow='{{strTableRowPart}}' tag='input' />

Hi,

Sorry I am very new and still confused, I ahve checkd the selector, teh info as below :

Appreciate the helps.

Thank you.

A.P.

the missing part is introduced here:

e.g.

Do not miss to set a default value to the used variable as this allows us to do the stand alone validation for a particular testcase

Hi, I ahve amend the script as attached. But when excel input data, it still jum back to the 1st line. Instead of the 2nd line. Appreciate the help.

Re
Flowchart.xaml (29.4 KB)
Supplier_list.xlsx (10.0 KB)

Regards,
AP.