Substitution For Get Row Item

I have an automation where I am looping through each row of a datatable and assigning values to variables using the Get Row Item activity. I am getting values for 8 different columns so I am using the Get Row Item activity 8 times. Is there a way to avoid having to use the activity 8 times in a row?

Hi @travis.bass

You can use the for each row in datatable activity to retreive each row in a datatable.
Inside for each use assign activities to store the each column value in a variable.

Hope it helps!!

1 Like

HI,

We can use Multiple Assign if you want to shorten workflow length.

image

Or if you want to handle these variables efficiently, we can use Dictionary or Array.

arrItem = CurrentRow.ItemArray

OR

dict = Enumerable.Range(0,dt.Columns.Count).ToDictionary(Function(i) dt.Columns(i).ColumnName,Function(i) CurrentRow(i))

Regards,

1 Like

Hi

Use the lookup data table activity to find the the rowIndex. Assign the rowIndex output to a variable called: int_RowIndex (Int32)

Let your datatable be called: Dt1

Then use a multiple assign like this to obtain your values:
Dt1.Rows(int_RowIndex)(COLUMNxNAME).ToString

This will let you capture/reference the values without a lookup/foreach.

Cheers

Steve

1 Like

Thanks. I used the Multiple Assign option and just assigned the variables to the column values I wanted. CurrentRow(“ColumnName”).ToString

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.