Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
P_Saltzer
Contributor
Contributor

Calling A Source an an If Statement

Hi All.  I'm hoping someone can assist me.  At the top of my data load editor I have sources listed.

SET Source_A = File1.txt

SET Source_B = File2.xlsx

SET Source_C = File3.xlsx

I want to be able to create an IF statement that looks at the sources and then creates a value in a field.  For example:

IF(Source_A, 'Lions',
     IF(Source_B, 'Tigers',
     IF(Source_C, 'Bears'))) AS Oh_My;

Any help will be greatly appreciated.

Labels (1)
1 Reply
rwunderlich
MVP
MVP

Source_A etc are variables. You can reference them in a script expression using $() syntax.  So your if condition would be like:

If('$(Source_A)' = 'something',  'Lions',...

I suspect what you are wanting to do is test the name of the file you are loading?  If so, your test would be:

if (FileName() ='$(Source_A)', 'Lions', ....

-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com