Adding values with loop to a data table - data table is not getting updated

hello,

can someone help me how can i add values to a data table in a ‘while’ activity? i use an assign activity DT.Rows(DT.Rows.Count-1).item(“column name”) = value that i want

it seems to have only insert correctly the first value, but don’t insert the second value next to come/replace the first value?.. (the data table is not updated with two values but only with one)

Hi!

You can use a variable to save the DT.Rows.count-1 which will change everytime you add another value to the dt intVariable=intVariable+1.
Use this variable inside the dt.rows(intVariable).

Hope it solved the problem.

@Lior_Ben_Naim

You need to use a counter to make this work

check below for your refernce

Hope this may help you

Thanks

no, it throw an error (on the second value entered) :Assign: There is no row at position 1.

@Lior_Ben_Naim

Can you share your process folder?

Also let me know you have already rows in datatable and updating the value, is this correct?

Thanks

i have no rows in the data table (besides for the default)

each time i am entering the loop i want to have clear datatable, the first value is enter right but it doesn’t update the rows count in the datatable and its “says” all the time that there is only one row

@Lior_Ben_Naim

Then you have to use Add row activity and pass your values

Hope this may help you

Thanks

i tried this, maybe you can tell me what to put under: ‘DataRow’?
as its dynamic

@Lior_Ben_Naim

You can use Arrayrow if you have multiple columns like below

{Value1,Value2,Value3…etc}

Hope this may help you

Thanks

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