Datatable handle

Greetings of the day…!!!
I have a build data table where I have declared two columns in it (Item, Quantity). I need to loop each separately to get the item and quantity. To get the item I have a separate for each and to get the quantity I have separate for each. Now how do I add these items and quantity in the single data table that is declared first? Please help me with the solution

For your first column “Item”, use an Add Datarow activity to add the item to the first column. You can do this through the ArrayItem field with {MyItem, String.Empty}, where MyItem is the variable containing your item.

In the second loop, make sure you have a variable RowIx set for the For Each activity. Use an assign statement with left value DtData.Rows(RowIx)(1), and right value of MyQuantity, where MyQuantity is your quantity value in the loop, and DtData is the datatable you’ve defined.

Keep in mind that this solution assumes that the order in which you’re iterating over the quantities and items is the same.

3 Likes

Thanks for your reply…
What will the value of RowIx and why do we use it

When you supply an Int32 variable RowIx to the For Each loop, it will be updated with the row number of the table. It’s important to remember that for the first row, RowIx will be 0, the second row will have RowIx 1, etc. It’s useful if you need to keep track of the position of the data you’re working with.

Thanks for your reply should we give a incerment in for each to increase the row index