How to fetch data separated by Tab into collection from Text File
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-08-18 05:32 PM
Hi ,
I need to Fetch data from text file into Collection and data in text file is separated by Tab .
Please suggest some idea.
Thanks in Advance .
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-08-18 06:16 PM
Te OLEDB VBO can read different data sources, depending on the inputs you provide it. Here is an example of reading an Excel file https://help.blueprism.com/1136332732
And https://www.connectionstrings.com/textfile/ is a good resource for alternative connection types, including text files.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-08-18 06:37 PM
Hi Priyanka_auti
If you have horizontal tab separated values, like e.g.
""1 2 3 4 5 6 7 8 9 10""
you can also alter the text to replace those horizontal tabs with e.g. commas, like such:
Calculation stage with expression: "" Replace([Data1]; Chr(9); "", "") "" ,
where [Data1] contains your horizontal tab string, and output this to the same or another dataitem.
""Chr(9)"" is the ascii charater for horizontal tab, you can see the ascii characters here:https://theasciicode.com.ar/ascii-printable-characters/lowercase-letter-a-minuscule-ascii-code-97.html .
The function Chr(Code) is a function in e.g. the calculation stage.
You can then input this csv to the ""Utility - Strings"" BO's action ""Get CSV As Collection"", which will give you a collection.
If you need to set the collection's column names from the first row, this will require you to programmatically alter the [Data1] dataitem with a linebreak, so that you can use the ""Utility - Collection Manipulation"" BO's action ""Set Column Names From First Row"", to set the first row to be the column names in your collection.
Good luck.
BR,
Mustafa
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-08-18 06:38 PM
Hi ,
Please suggest how can i replace tab separated data by comma.
Thanks.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-08-18 06:43 PM
Hi Mustafa,
Thank you for update.
I have input like :
1 2 3 4
5 6 7 8
8 9 5 3
and want to store this data from text file to collection
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
07-08-18 01:46 PM
Hi Priyanka_auti
Please see attached BO to see how I would have solved it, the ""Utility - Strings"" BO's action ""Get CSV As Collection"", did not work as I intended it to. So instead I used ""Utility - Strings"" BO's action ""Split Text"".
Please see attached file.
Good luck.
BR,
Mustafa
