Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
HI,
What should be the expected output?
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
Output of new_field
Bravo
Delta
With my code, I see either Bravo or Delta.
maybe like this ?
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
];
or if it's just those two substrings, a shorter although less flexible solution might be:
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
];
Thanks for your suggestions MarcoWedel. Very impressive. I'll try both solutions and provide feedback.