Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
NEW webinar Dec. 7th: 2023 Outlook, A Pivotal Year for Data Integration SIGN ME UP!
cancel
Showing results for 
Search instead for 
Did you mean: 
LarryM
Contributor
Contributor

Extract multiple values from a row

Hello...looking for some help with this scenario

I have a row with data "alpha bravo charlie delta echo"

Looking to match bravo and delta into a new field.

I'm using
if (WildMatch(row, "*bravo*"), "Bravo",
if (WildMatch(row, "*delta*"), "Delta",
"NOMATCH"
)) as new_field;

This matches either bravo or delta. How do I get both? Thanks

Labels (3)
6 Replies
abhijith28
Creator II
Creator II

HI,

What should be the expected output?

Thiago_Justen_

Hi there.

I'm not sure If I got your point but let me try:

If(WildMatch(row, '*bravo*delta*'),'Bravo or Delta', 'No Match')

 

Cheers

Thiago Justen Teixeira Gonçalves
Farol BI
WhatsApp: 24 98152-1675
Skype: justen.thiago
LarryM
Contributor
Contributor
Author

Output of new_field

Bravo

Delta

With my code, I see either Bravo or Delta.

MarcoWedel

maybe like this ?

MarcoWedel_0-1658507200736.png

 

 

mapFindSubStrings:
Mapping
LOAD SubStr,
     '@start@'&SubStr&'@end@'
Inline [
SubStr
bravo
delta
];

tabString:
LOAD String,
     TextBetween(FindSubStrings&'@start@NOMATCH@end@','@start@','@end@',IterNo()) as new_field
While IterNo() <= RangeMax(SubStringCount(FindSubStrings,'@start@'),1);
LOAD *,
     MapSubString('mapFindSubStrings',String) as FindSubStrings
Inline [
String
alpha bravo charlie delta echo
alpha bravo charlie echo
alpha charlie delta echo
quebec lima india kilo
sierra echo november sierra echo
];
MarcoWedel

or if it's just those two substrings, a shorter although less flexible solution might be:

 

MarcoWedel_1-1658507883787.png

 

tabString:
LOAD String,
     SubField(Pick(WildMatch(String,'*bravo*delta*','*delta*bravo*','*bravo*','*delta*')+1,'NOMATCH','bravo,delta','delta,bravo','bravo','delta'),',') as new_field
Inline [
String
alpha bravo charlie delta echo
echo delta charlie bravo alpha
alpha bravo charlie echo
alpha charlie delta echo
quebec lima india kilo
sierra echo november sierra echo
];
LarryM
Contributor
Contributor
Author

Thanks for your suggestions MarcoWedel. Very impressive. I'll try both solutions and provide feedback.