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

Fix Format for If Then Else

Good Morning - I've created the following If/Then/Else statement in a script to use as a field in a list box, but it is not functioning exactly as I thought.   

My field: ([PO]Ship To Location (Location ID)) has values that start with 'SHARE:' and those that do not.   When the value is 'SHARE:' I want the value to be 'Met Location' and all other values to be 'Other Location'.  

I'm not understanding what I'm doing wrong with the following script line.  The only value that is showing up is 'Other Location' at this point

if(MATCH("[PO]Ship To Location (Location ID)", 'SHARE:'), 'MET Location', 'OtherLocation') as ShipToLocation,

Any help is much appreciated.

George

Labels (2)
1 Solution

Accepted Solutions
Taoufiq_Zarra

@gfisch13 

May be wildmatch instead of Match

example :

 

Data:
load *,if(wildmatch(Field, 'SHARE:*'), 'MET Location', 'Other Location') as ShipToLocation inline [
Field
SHARE:blabla
blabla
];

 

 

output :

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

3 Replies
Taoufiq_Zarra

@gfisch13 

May be wildmatch instead of Match

example :

 

Data:
load *,if(wildmatch(Field, 'SHARE:*'), 'MET Location', 'Other Location') as ShipToLocation inline [
Field
SHARE:blabla
blabla
];

 

 

output :

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
gfisch13
Creator II
Creator II
Author

Taoufiq - this is great, thank you for your input.   Was using MATCH more limiting than the WILDMATCH?  I just want to understand since it seems that our expressions are virtually the same.

Appreciate your time!!!

George

Taoufiq_Zarra

with pleasure George,

the trick is that with WILDMATCH you can use '*' at the end to compare the values starting with 'SHARE:.....' which is your case otherwise Match will work very well if you compare with 'SHARE:'  i.e. the exact word

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉