HELP about split !!

junjie

Member
hi guys,
could you pls help me this :)
I would like to get only country names (if any duplicate names, any city names ...are not selected, and South Korea or Korea it will pick up Korea only...) from this cell.
How should we do that?
Expected result : have a collection with this column where it contains only country names, and from that I would like to loop them one by one.
1617674144187.png
 
I was checking the you request and making some logics with split string utility in BP .
Its can be separated by ; then after that by , and then move those into one collection .

Result you need is a collection in which values will be china, hongkong, australia, vietwnam etc. Just correct me if my assumption is clear on your request.
 

sahil_raina_91

Active Member
@shikhar.mishra yes correct. :)
appreciate your help ... sharing the steps (in blue prism) to do this.
result is that a collection that cell contains only the country names.

1. Read the A2 cell value in text data item [Data]
2. Use Replace(Replace(Replace([Data],"Asia:",""),"Others:",""),";",",") in calculation stage and store output in [Data]
3. Use Action Split Text in Utility-Strings VBO :
Text to Split : [Data]
Split Char : ","
Collection Field Name : "Flights To"
 
Last edited:

junjie

Member
@sahil_raina_91
thanks a lot for your kind help :)
it still remains the cities like shanghai, bangkok, taipei ...
Is there additional step to filter or pick up only country names?
 

sahil_raina_91

Active Member
@sahil_raina_91
thanks a lot for your kind help :)
it still remains the cities like shanghai, bangkok, taipei ...
Is there additional step to filter or pick up only country names?

Filtering for only "Countries" is a Business Condition. There is no way to filter directly.
You will have to write additional code, use some api to validate.

For example, create a list of all possible countries and loop the collection. If the value does not exists in the list, delete from collection.
 

junjie

Member
oh , then we prefer to follow your recommendation to create a list of all possible countries.
after that, how to do in order to delete those countries/cities not matching with this list? :)
 

sahil_raina_91

Active Member
oh , then we prefer to follow your recommendation to create a list of all possible countries.
after that, how to do in order to delete those countries/cities not matching with this list? :)

You can create a collection with all possible countries (This can be an environment variable as well, to allow you to update in future).

Now, loop Flights collection and for each row, use action "Collection contains value from Collection Manipulation VBO" to check if the value exists in possible countries collection.
If the value exists, delete the current row from Flights collection.
 

junjie

Member
great :) ~
thanks so much for your help :)
now I have this table in a collection.
how to turn them into a collection where each of the country is in a row ?
because after that I will need to use loop to pick up each country 1 by 1.

1618036138716.png
 
Top