Foreach loop with index

I am trying out the foreach loop on a simple table. The action flow and table are in the screenshot below:

The output I get is:


When the index is specified, the output comes as the value within the square brackets []. Why isn’t just the value output in this case (doesn’t the index also point to the specific element in the list and is the same as the nested foreach for each item in a row)?

Hi, run another for loop with that index and you should only see the value without the brackets

If I understand correctly you are saying there needs to be another foreach element in [object obtained by using the index], within which the element variable will have the final value.
How do I make the index as the list/table variable for the for loop?

post your script here, will add the loop and show you, if my understanding of your request is correct


openAndFocus("notepad", 5000, 300);

def i0 = data
if (data instanceof {
i0 = data.getRowsAsListWrappers()

new“2,3”).applyTo(i0).forEach( { row ->
def i1 = row
if (row instanceof {
i1 = row.getRowsAsListWrappers()

new"*").applyTo(i1).forEach( { item ->

        def i2 = item;

		if (item instanceof {
			i2 = new"1").applyTo(item);

		} else if (item instanceof {
			i2 = new"1").applyTo(item);

		} else if (item instanceof BigDecimal) {
			i2 = item.toPlainString();



    sendKeys(" "));


    sendKeys(" "));


        def i3 = row;

		if (row instanceof {
			i3 = new"2").applyTo(row);

		} else if (row instanceof {
			i3 = new"2").applyTo(row);

		} else if (row instanceof BigDecimal) {
			i3 = row.toPlainString();



    sendKeys(, 13, 10, 0));


can you export the recording in a zip file and upload it here please (1.8 KB)

please test and see if it (2.1 KB)


1 Like

filter for 2 at the item1 loop, remove all other filters

1 Like

@gerhardus_meyer thanks. This is working.

My confusion was that using the Index I thought it gives the actual value but that still returns a List which needs to be looped further to get the elements.

@mprateek Yes, that’s right. For Each (row) always returns a list, even if you use index and there is only one element in the list.

Looks like a reinventing the wheel. I think that accessing a value from row by index should return the plain cell value without any square brackets.

1 Like

Hi Mykhailo,
Yes, we’ll fix the issue with square brackets in the future releases. For now, the workaround suggested by @gerhardus_meyer is the best way to go.


@mprateek @mykhailo_hariachyi @gerhardus_meyer
This issue has been fixed in RPA Express 1.2.0 - index inside For Each loop action returns a value without square brackets.

1 Like


I am scripting one flow wherein I need to enter values present in the table to a web form.

I have used for each function to submit the same form multiple times.

Problem statement :-

I don’t see any index feature in the Web element action, and hence when I set the variable to the ${item} pointing to the table, the entire column data gets set to that field I am pointing to.

Any workaround here?


@harmeet_singhn You need to include another for each loop as shown in the post above to iterate through elements in the row.