Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Conditional Table

hi,

i have two Two table A,and B and a variable var

if var value is 1 then load the table A else load the table B

any suggestion on this???

1 Solution

Accepted Solutions
sunny_talwar

May be something like this:

IF $(Var) = 1 then

     LOAD fieldNames

     FROM TableA;

ELSE

     LOAD fieldNames

     FROM TableB;

ENDIF

View solution in original post

3 Replies
oknotsen
Master III
Master III

Go to the Layout tab for each chart. On there you will find a Show option in the middle on the right-hand side. For table A set something like this in there:

var = 1

For table B something like this:

var <> 1

If you mean in your script, you could work with a CASE:

http://help.qlik.com/sense/2.1/en-US/online/#../Subsystems/Hub/Content/Scripting/ScriptControlStatem...

May you live in interesting times!
sunny_talwar

May be something like this:

IF $(Var) = 1 then

     LOAD fieldNames

     FROM TableA;

ELSE

     LOAD fieldNames

     FROM TableB;

ENDIF

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Or in your script:

IF var = 1 THEN

TableA:

LOAD * FROM TableSource (options);

ELSE

TableB:

LOAD * FROM OtherTableSource (options);

END IF

You can add an inputbox couple to var on a sheet to control the script code execution path.

Peter