Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
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
@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
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
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
@MayilVahanan , thank you so much that's working