Hello,
I am using data service query and getting IList, I would like to convert this IList to a datatable
What is the easiest way to do this ?
thanks
Hello,
I am using data service query and getting IList, I would like to convert this IList to a datatable
What is the easiest way to do this ?
thanks
Hello @adext Welcome to the UiPath Community Forum.
With the above intended and most suitable method, here is the quick snippet used with single assign activity.
yourDataTable = (New System.Data.DataTable()).LoadDataRow(yourIList.ToArray(), true)
Thanks
hello @shantanu_chande thank you
i get this error
@adext Please find attached answer by @lrtetala which type casts the IList Element to DataRow object and then adds it to the desired datatable.
Please check and let us know.
So, we assume it is a list(Of YourEntitiyType)
Therefore the datatable will have defined the Columnstructure (we assume all DE Entity fields are needed)
As mentioned within the Links within a loop the new DataRow of the prepared DataTable will be filled with the Entity Fields
When it is about many fields we can dynamize the conversion by using:
We keep in mind:
so how for example? i’m not sure about how to create a loop doing this
hi @shantanu_chande @lrtetala , i am getting this error now
Assign: Unable to cast object of type ‘Dep.DepDT’ to type ‘System.Data.DataRow’.
place new Object() before the {
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.