cancel
Showing results for 
Search instead for 
Did you mean: 

Split Text into multiple lines

Lily.L
Level 5

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 

11759.png

11760.png

11761.png

11762.png

11763.png

11764.png

and result look like this:  [8899] cat - cat food[9988] dog - dog food

Thank you so much!

M



------------------------------
Mia Mikela
------------------------------
5 REPLIES 5

harish.m
Level 12

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



------------------------------
-----------------------
If I answered your query. Please mark it as the "Best Answer"

Harish Mogulluri
Lead developer
America/New_York TX
------------------------------
----------------------- If I answered your query. Please mark it as the "Best Answer" [FirstName] [LastName] [Designation] [JobTitle] [City] [State] [Phone]

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?

11680.png

split text:

11681.png

11682.png

write to collection:

11683.png

11684.png

split line

11685.png

11686.png

Write to colelction

11687.png

11688.png



------------------------------
Mia Mikela
------------------------------

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"?


11695.png


11696.png

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

11697.png
------------------------------
-----------------------
If I answered your query. Please mark it as the "Best Answer"

Harish Mogulluri
Lead developer
America/New_York TX
------------------------------

----------------------- If I answered your query. Please mark it as the "Best Answer" [FirstName] [LastName] [Designation] [JobTitle] [City] [State] [Phone]

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



------------------------------
Mia Mikela
------------------------------

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 .



------------------------------
-----------------------
If I answered your query. Please mark it as the "Best Answer"

Harish Mogulluri
Lead developer
America/New_York TX
------------------------------
----------------------- If I answered your query. Please mark it as the "Best Answer" [FirstName] [LastName] [Designation] [JobTitle] [City] [State] [Phone]