Get Collection as CSV output is not a comma seperated values??
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
18-03-18 05:08 PM
I am using collection as CSV and the output is not comma seperated values. Is this how it works ? Any other action that can give me collection values as CSV ?
4 REPLIES 4

Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
23-03-18 07:46 PM
Hi, I am assuming that you are familiar with the use of code stage
Create a code stage with 2 input parameters, CSV_File_Name_With_Path and Collection_Input and in the Code tab, paste the below code. Let me know if this does not work. Would be better if you add this as a separate action in the collection manipulation VBO, so that you will have to add only System.Text namespace in the 'Code Option' tab in the Initialise action.
If Collection_Input.Columns.Count = 0 Then Throw new ApplicationException(""Zero columns in collection"")
Dim objOututStream As StreamWriter
objOututStream = File.CreateText(CSV_File_Name_With_Path)
''Dim Columns As New DataTable
Dim SB As StringBuilder = New StringBuilder()
For intColCnt As Integer = 0 To Collection_Input.Columns.Count - 1
SB.Append("""""""" + Collection_Input.Columns(intColCnt).ColumnName.ToString() + """""""")
If intColCnt Collection_Input.Columns.Count - 1 Then
SB.Append("","")
End If
Next
SB.Append(vbNewLine)
For intRowCnt As Integer = 0 To Collection_Input.Rows.Count - 1
For intColCnt As Integer = 0 To Collection_Input.Columns.Count - 1
SB.Append("""""""" + Collection_Input.Rows(intRowCnt)(intColCnt).ToString() + """""""")
If intColCnt Collection_Input.Columns.Count - 1 Then
SB.Append("","")
End If
Next
SB.Append(vbNewLine)
Next
objOututStream.WriteLine(SB.ToString())
objOututStream.Close
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
04-04-18 01:09 PM
If you open the code stage you will see a list of delimiters in the code. They are set to True or False. Change the setting in the code for the delimiter you need.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
14-05-18 11:42 AM
What is your ultimate goal ? i am hoping that you want to store the Collection values as a CSV file, if that is the case you can follow below steps.
1. Create a single row collection with one field.
2. Use Utility String VBO - > get collection as CSV action.
3. in input provide your collection, in output provide your single row collection field name, note that it is a text field not collection, use collectionName.fieldName
4. Next stage should use Utility File Management VBO - > Write Text file action, input your file name *.csv, in Text input parameter enter your single row collection, use collectionName.fieldName.
Run the process you should be able to write the collection as CSV file, comma seperated.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
14-05-18 12:27 PM
Good and working suggestion by sibi_luke, very useful if any one wants to create csv with delimiter of choice.
