Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Announcing the newest addition to the Qlik Community, Qlik Gallery! Learn More
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???

Tags (1)
1 Solution

Accepted Solutions

Re: Conditional Table

May be something like this:

IF $(Var) = 1 then

     LOAD fieldNames

     FROM TableA;

ELSE

     LOAD fieldNames

     FROM TableB;

ENDIF

3 Replies
oknotsen
Honored Contributor III

Re: Conditional Table

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!

Re: Conditional Table

May be something like this:

IF $(Var) = 1 then

     LOAD fieldNames

     FROM TableA;

ELSE

     LOAD fieldNames

     FROM TableB;

ENDIF

Re: Conditional Table

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