Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

How to read 1 single string A|B|C|D from Launch and split into 4 entries in evar

1982luca
Level 8
Level 8

Hello everyone,

 

How can I split this single string A|B|C|D from Launch into 4 differents entries?

Thanks

1 Accepted Solution
yuhuisg
Correct answer by
Community Advisor
Community Advisor

The simplest is with custom code:

 

var str = "A|B|C|D";
var values = str.split("|");
// values = ["A", "B", "C", "D"]

 

 

View solution in original post

11 Replies
yuhuisg
Correct answer by
Community Advisor
Community Advisor

The simplest is with custom code:

 

var str = "A|B|C|D";
var values = str.split("|");
// values = ["A", "B", "C", "D"]

 

 

View solution in original post

1982luca
Level 8
Level 8

Hi yuhui, AA receives this string "A|B|C|D" via API. I would like to store in evar X (AA) A, B, C D as single entry not as string

1982luca
Level 8
Level 8
@yuhuisg: It is useful approach but now we have evar X 1:ABC|2:DEF|3:KLN from Launch and I need to save into evar (report suite), ABC OR EDF OR KLN.
yuhuisg
Community Advisor
Community Advisor
@1982luca the solution is still the same: you need to use list variables
1982luca
Level 8
Level 8
@yuhuisg, It works well, If I use List Variable but I have an import data from API 1.4 where I dont use List Variable. Can I use List Variable from API?
yuhuisg
Community Advisor
Community Advisor

@1982lucaI'm not familiar with using the API, unfortunately. But I assume that list variables should be supported.

1982luca
Level 8
Level 8
@yuhuisg, I tried to use list2 with API 1.4 but I got an error. It is not supported. I m trying to read the string like this "1|2" by using this regex in Classification Builder((?:[^\\|]+|\\\|?)+). Any idea how to match 1 and 2? I tried ((?:[^\\|]+|\\\|?)+)[1] but it doesnt work.
yuhuisg
Community Advisor
Community Advisor
@1982luca also, I don't think Classification will work in your use case. Classification means that for your variable, you have defined 2 classifications for it (e.g. like 2 sub-variables), and you want to use "1" in the first classification, and "2" in the second classification. But you're splitting the "1|2" string "horizontally", when based on your original post, you want to split the string "vertically".