How to convert the output of an Enumerate object activity to Datatable?


I would like to convert the ouput of an Enumerate object activity which is System.Collections.Generic.IEnumerable<UiPath.FTP.FtpObjectInfo> to a Datatable.
How should I proceed?



in general we prepare an empty datatable with the target column structure - e.g Build DataTable activity and then populate it by looping with a for each over the IEnumerable.

In some scenarios we also have a chance to make it more compact with a LINQ

Thank you, @ppr ^^!

I’ve followed your advice, but when trying to Add Data Row to my new outputDT, this current item used to iterate through the output of Enumerate object activity in my For Each, seems not working because of its incompatibility.
Compiler error(s) encountered processing expression “currentItem”.(2): error BC30311: Value of type ‘FtpObjectInfo’ cannot be converted to ‘DataRow’.

Any ideas?

oh we will not add directly. We will use the properties / infos seperately for populating a new empty DataRow (retrieved from YourDTVar.NewRow)

Can you do the following:

use the immediate panel: YourIEVar.First()
and share with us the Screenshot

Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

The output of MyIEVar.First() is Exception has been thrown by the target of an invocation.
And using a log message in order to see this output, it says that Sequence contains no elements.

sure we cannot do on empty return

Lets assume the following:

DataTable Preperation - dtData
We started with one column for the name

Looping, newRow, Poplation, Adding

For each TypeArgument = FtpObjectInfo
myNewRow(“Name”) = item.Name

Once you got this working, feel free to add additional porperties and retrievals

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