This will show you how to take a collection and save as a CSV with custom delimiter.
Prerequisites
New business object with a code language of C#
Code options to be used for this to work.
There needs to be the following inputs –
Collection – Collection
Delimiter – Text
Target – Text
In the code section if you use the following C#
StringBuilder sb = new StringBuilder();
string[] columnNames = Collection.Columns.Cast<DataColumn>().
Select(column => column.ColumnName).
ToArray();
sb.AppendLine(string.Join(Delimiter, columnNames));foreach (DataRow row in Collection.Rows)
{
string[] fields = row.ItemArray.Select(field => field.ToString()).
ToArray();
sb.AppendLine(string.Join(Delimiter, fields));
}File.WriteAllText(Target, sb.ToString());
If you have your data items set correct along with the collection it may look something like this.
In this example it will save the collection in C:\RPA\file.txt
Enjoy!