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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Saravanan_Desingh

Table Name inside IF Condition

Hi, I am trying to code something like this,

IF $(vSource)='XL' THEN

RawDate:

LOAD

..

FROM ...xls

ELSE IF $(vSource)='DB' THEN

RawData:

ODBC CONNECT TO SandBox;

SQL SELECT ..

END IF

Based on a condition, I am trying load data either from XLS or DB. But this is not working. Even I tried giving the Table Name (RawData) Above the IF Loop. No luck either.

Do you have any suggestion for me? In either case, I need the Table Name to be RawData.

1 Solution

Accepted Solutions
maxgro
MVP
MVP

use an action for the button

1.png

View solution in original post

7 Replies
sunny_talwar

Where does the script determine if vSource is XL or DB?

Saravanan_Desingh
Author

I am hard-coding it now.

SET vSource='XL';

But planning to get this value thru a Button click.

maxgro
MVP
MVP

this works, you have to adapt to your requirement the let vSource......

let vSource= pick(ceil(rand()*2), 'XL', 'DB');

// or let vSource = 'DB' ......;

IF ('$(vSource)'='XL') THEN

  //RawDate:

  //LOAD

  //..

  //FROM ...xls

  TRACE 'XLS';

ELSEIF ('$(vSource)'='DB') THEN

  // RawData:

  // ODBC CONNECT TO SandBox;

  // SQL SELECT ..

  TRACE 'DB';

END IF;

maxgro
MVP
MVP

use an action for the button

1.png

Saravanan_Desingh
Author

Thank you so much, maxgro. This works.

Saravanan_Desingh
Author

One more thing. What object you have used to get 'vSource=DB'?

maxgro
MVP
MVP

Input Box