Hi,
Can you try Rows property (or AsEnumerable method) of the Datatable and set DataRow at TypeArgument as the following?
OR try ForEachRow activity instead of ForEach
Regards,
For outer loop, since you are iterating through the list of datatables, the type argument will be system.data.datatable.
For inner loop, since you are iterating through each row in the datatable, the type argument will be system.data.datarow.
Hope this helps,
Best Regards.
Hi,
Thanks for the reply. Anyhow, If I set Outer loop as System.data.Datatable, It’s showing "object reference not set to an instance of object error.
Best,
Salman
Hi,
Thanks for the reply Yoichi. I tried your way but it throws error as “Object reference not set to an instance of the object”.
Will you please let me know, I’m given a use case to take an excel file and classify all the order ID’s with the mode of payment like cash/EMI. For that i created different datatables for different mode of payment by storing the whole excel into an “Excel_Datatable” and filtering it and storing it in seperate datatable named “cash_DT”, “EMI_DT”. and looping into the list of datatables. Whether this will work?
Best,
Salman
Whatever you are thinking works.
I guess the problem is you used the name datatable… try changing the name to dt or something
And the second loop try using for each row in datatable directly instead of another for each
Cheers
HI,
Hope the following sample helps you.
In this case, it may be better to use Dictionary instead of List, as the following, for example, because we can access each datatable by key (such as “cash”)
Sample20230313-1L.zip (10.9 KB)
note: Just to be sure, it’s better not to use variable named “datatable” (even if it works in the above),because name resolution, may be ambiguous with DataTable class, as @Anil_G metioned.
Regards,
Thanks ! Thats was the issue. It’s resolved!
Thanks man! it worked!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.