Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Micki
Creator
Creator

Advanced select from strings specific words

Hi, 

i have a string 

'27997:Google Chrome browser:Passed&&27997:MS Edge browser:Passed&&32163:Google Chrome browser:Passed&&32163:MS Edge browser:Passed&&32163:Safari browser for Mac:Not Run&&32128:Google Chrome browser:Not Run&&32128:MS Edge browser:Not Run&&32128:Safari browser for Mac:Not Run'

What i need to select all parts that started from the same number: like - 32163,

final result :

'32163:Google Chrome browser:Passed,32163:Safari browser for Mac:Not Run, 32163:MS Edge browser:Passed'

Does it possible without any loops? 

 

thanks 

 

Labels (1)
1 Solution

Accepted Solutions
MayilVahanan

HI @Micki 
May be try like below

T:
LOAD String, If(SubField(Text, ':',1)= '32163', Text) as Text;
LOAD *, SubField(String, '&&') as Text Inline
[
String
27997:Google Chrome browser:Passed&&27997:MS Edge browser:Passed&&32163:Google Chrome browser:Passed&&32163:MS Edge browser:Passed&&32163:Safari browser for Mac:Not Run&&32128:Google Chrome browser:Not Run&&32128:MS Edge browser:Not Run&&32128:Safari browser for Mac:Not Run
];

LOAD Concat(Text, '&&') as FinalText Resident T;

Pls check the FinalText  field , hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

5 Replies
marcus_sommer

Is it a single string or multiple ones? If it's a single string it might be useful to split them into multiple records and maybe also various fields. This could be easily done in the script with subfield() - the version with 2 parameters creates extra records and the one with 3 parameters returned the indexed string-part.

- Marcus

Micki
Creator
Creator
Author

@marcus_sommer , it's single string s in one column, i need just to do it as a single action and put in in one column 

marcus_sommer

You mean to cut these parts from the rest of the string? Especially if the strings vary rather heavily in regard how many parts are concatenated and in which order and how many hits are possible it could become quite ugly to do this with any string-functions. Therefore I suggest to consider the above mentioned logic with subfield().

- Marcus

MayilVahanan

HI @Micki 
May be try like below

T:
LOAD String, If(SubField(Text, ':',1)= '32163', Text) as Text;
LOAD *, SubField(String, '&&') as Text Inline
[
String
27997:Google Chrome browser:Passed&&27997:MS Edge browser:Passed&&32163:Google Chrome browser:Passed&&32163:MS Edge browser:Passed&&32163:Safari browser for Mac:Not Run&&32128:Google Chrome browser:Not Run&&32128:MS Edge browser:Not Run&&32128:Safari browser for Mac:Not Run
];

LOAD Concat(Text, '&&') as FinalText Resident T;

Pls check the FinalText  field , hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Micki
Creator
Creator
Author

@MayilVahanan , thank you so much that's working