First of all I’m not an UIpath expert yet and got a lot of info from this forum which helped me to get where I am now; thanks all for that!
In short; I’m currently trying to copy data from an ms excel sheet(3 columns;462 rows (first row is headers)) into an ms access db. What i’ve done so far is to get UIpath to;
read the excel sheet and output it into a datatable (Dt1)
with click image activity’s go to access
with click image activity’s open the filter function
take the first value(row2) from column 1 from Dt1 and use it to filter in ms access
use hotkeys to go to a column to the right
take the first value(row2) from column 2 from Dt1 and enter it in this column in ms access
use hotkeys to go to another column to the right
take the first value(row2) from column 3 from Dt1 and enter it in in this column in ms access
with click image activity’s clear the filter funtion
Steps 3 to 9 is currently in the activity; for each row in datatable. So my expectation was that after step 9 it would go back to step 3 and then take the values from row3 in Dt1.
The problem is that it after step 9 it goes back to step 3 but it uses the same values from row2 again.
I’m currently using these expressions in a type into activity to get the data from;
Column 1 = Dt1.Rows(0).Item(0).ToString
Column 2 = Dt1.Rows(0).Item(1).ToString
Column 3 = Dt1.Rows(0).Item(2).ToString
How do I get UIpath to take values from the next row when it loops back to step 3 in the second run and so on and so on?
Please tell me what I’m doing wrong here.
I’m using UIpath studio 2022.10.3
Do not use ‘Dt1.Rows(0)’ in your assign activity. It will always refer 1 row of the table. You have to use ‘CurrentRow’ or ‘row’ variable from the ‘For each row’ activity. So your assign activity should be like below.
You both gave the proper solution!
I went for the solution of supermanPunch with the screenshot which was very clear and description of the expression per column.
If I understand correctly I should not have to put the row number because I want it to iterate to the next one and the activity ‘for each row in datatable’ is taking care it is iterating to the next row right? Same with the Dt1 that I should not use in the expression because the activity already says it is from Dt1 right?