Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
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
Partner Ambassador/MVP
Partner Ambassador/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