30-09-23 12:23 AM
Hi there,
I want to split text and store it in multiple lines
1/ I have a reference text box - reference output has multiple lines; for example
In "Pet Category" Reference, we have:
[8899] cat - cat food
[9988] dog - dog food
[7788] pet - pet food
[9977] cow - cow milk
However, when I store them in a collection, then the text looks like this [8899] cat - cat food[9988] dog - dog food[7788] pet - pet food[9977] cow - cow milk
How can I make them look like the original output:
[xxxx] ABC - def
[yyyy] ghj - klm, and so on
2/ My reference text box outcome will come in different ways; some of them will have 1 line, some of them will have 2 lines some of them will have 3 lines, and so on.
In this case, what's the best way I should do?
I have tried split text but it doesn't look correctly
and result look like this: [8899] cat - cat food[9988] dog - dog food
Thank you so much!
M
01-10-23 02:57 AM
Hi Mia Mikela,
If the text you are referencing has new line for each value"[8899] cat - cat food" then first you need to use "Utility - Strings" VBO Action: Split Lines
then it will give each value as new row in the collection
I put together screenshot for similar question. you can refer below thread.
https://community.blueprism.com/question/removing-empty-rows-from-a-string#5e612126-25f0-4563-b1da-018ae537b04c
01-10-23 04:06 AM
Hi Harish,
Thanks for replying , I have tried but it doesn't work.
My steps: because the initial value looks like this: [8899] cat - cat food[9988] dog - dog food, so I have to make a space between food [9988], then I do split text, append to the collection, split line and append to collection. Can you please have a look at my steps?
split text:
write to collection:
split line
Write to colelction
01-10-23 04:48 AM
Hi Mia Mikela,
if I understand your questions.
you need to split this text"[8899] cat - cat food[9988] dog - dog food[7788] pet - pet food[9977] cow - cow milk" as diff rows?
If that is the case, you can split based on "[" and readd the brackets once split is completed. I wont relay on space since it might end up with more rows and make confuse it.
Also I noticed your split action doesnot have collection field value. Assuming your collection has field called "Column1"?
You need to remove emoty cells using utility collection action empty rows and to append the brackets at the beginning you can loop the collection and add brackets one at a time. There might be other ways to do it as well
------------------------------
-----------------------
If I answered your query. Please mark it as the "Best Answer"
Harish Mogulluri
Lead developer
America/New_York TX
------------------------------
01-10-23 08:53 AM
Hi Harish,
Thank you for your time. I want to ask: in my case, the reference text box outcome will come in different ways; some of them will have 1 reference line, some of them will have 2 reference lines some of them will have 3 reference lines, and so on.
In this case, what's the best way I should do? I should add a Loop, but where should I put the loop?
And, in the 2nd image, I see the collection field text is "Value". -> How do you do that?
In my case, in the collection, I have 1 column for reference text. After I get the out reference lines, I will add them to the collection, in the reference text column. Therefore, in the Collection field name in your 2nd image, should I put. Queue Data. Reference Text? [As Queue Data is Collection and Reference Text is the column for the reference output]
Thanks again!
M
01-10-23 01:36 PM
Hi Mia Mikaela
I think regardless of the no of reference lines it will work, but test ones 2ith different data and see whether it is working
In the 2nd image collection field has " value" because i have created collection with column name value.you can use the collection field name .