Solved Write .txt into a collection

andrea93

Member
Hi,
i have a this txt(screen) with a value separated with comma.
i would write this value into a collection

How can i do?
 

Attachments

  • value.txt
    138 bytes · Views: 73

sivagelli

Well-Known Member
This is how you can get it.

1. Get the file content in to a data item using Calc stage with LoadFile("<FilePath>") passing the file path in to the function.
2. Use Utility String vbo and Split Lines action to get them in to a collection with two rows
3. Use Loop stage on each row and use 'Split Text' action passing comma (,) as delimiter to split the row content in to a collection.

Disadvantage is that, you will get a collection for each row and have to use 'Merge' action from Collections Manipulations VBO if you wish to end up with single collection at the end. Note: if the same column names exist in collections, 'Merge' will return an error. You have to change the Field names before Merging.

Hope this helps!
 

andrea93

Member
This is how you can get it.

1. Get the file content in to a data item using Calc stage with LoadFile("<FilePath>") passing the file path in to the function.
2. Use Utility String vbo and Split Lines action to get them in to a collection with two rows
3. Use Loop stage on each row and use 'Split Text' action passing comma (,) as delimiter to split the row content in to a collection.

Disadvantage is that, you will get a collection for each row and have to use 'Merge' action from Collections Manipulations VBO if you wish to end up with single collection at the end. Note: if the same column names exist in collections, 'Merge' will return an error. You have to change the Field names before Merging.

Hope this helps!
This ok
input: data item
output: coll output
I would like to have the collection of output this way :
 

Attachments

  • Coll output.PNG
    14.1 KB · Views: 56

sivagelli

Well-Known Member
Two options i can think of-

Solution#1
1. Get the file content in to a data item using Calc stage with LoadFile("<FilePath>") passing the file path in to the function.
2. Use Utility String vbo and Split Lines action to get them in to a collection with two rows
3. Write the Collection to Excel
4. write code stage to make Text to Columns
5. Read the data in to collection

Solution#2
Write code stage to deal with collections splitting the column with text separated by delimiter in to multi columns.
 
Top