Can I output collection( type “System.Collection.Generic.ICollection<System.Dtring>”) to csv

Error has thrown, using Write CSV activity with collection ( type “System.Collection.Generic.ICollection<System.Dtring>”) like

Implicit conversion would not be applied from collection into datatable

how can i output collection date into csv with using Write CSV activity?

Hi @ryoryo,

Without datatable input I don’t think that we can invoke the write csv activity, since its input is datatable only.

May I know the reason why you don’t want to convert the list to datatable as you mentioned,

quote=“ryoryo, post:1, topic:37095”]
Implicit conversion would not be applied from collection into datatable

Hi sarathi125
Thanks for your helpful comment.
I’m not clear how to convert from type:collection to type:datatable.
Is that like using “for each” activity and insert to table with loop? or are there any simple way
or activity to convert those types?


Hi @ryoryo,

You are on the right track. I found that the quick way to convert a list of strings into the DataTable is with the activity Generate Data Table. See attached xaml file:

Collection to DataTable.xaml (5.9 KB)

Because Generate Data Table takes a string as an argument, you basically join your collection into one string with any unique separator and then use the same separator to split your string into rows of the Data Table.

You can then use your DataTable variable inside the Write CSV activity to write it into the file.

Hi @loginerror
Thanks for your comment. I saw your code attached.
To convert the type from list or collection , is outline is like follows?
I’m sorry that i was not clear and just need to confirm.

  1. $list {“hoge”,“foo”}
  2. combining each factors to one line string using certain separator like “hoge|foo”
    ↑I thought this is defined in ColumnSeparators proprerty on Generate Data Table activity.
  3. to insert into dataTable each row , separate each factors with identifying “|”

if in that way, which place in property indicating 3). It actually means,

"to separate with using “|” and insert it in each row in certain table "

btw, congratulations on winning in first match in World cup!

Hi @ryoryo,

The activity Generate Data Table takes one string as input and then separates it into Columns and Rows based on the separators you specify in the Formatting Options (“Column Separators” and “New Line Separator”).

But because you start with a list of strings, you need to combine them into that one long input string.

Naturally, you need to have an input string that you can easily separate again using the Formatting Options of the Generate Data Table activity. Therefore, when combining your list into a single string, you must use a custom separator that will be unique to the data.
This is why you have to specify the separator twice - once to join the list of strings, and again to split it into rows.

Hope that helps :slight_smile:

Hi @loginerror
It became clear.
thanks again for your coroporation!