Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Highlighted
Partner
Partner

use of "if with let variables" within the script (syntax error)

Hi community stalwar1‌,

I'm trying to do sthing like this :

if( $(vNbr) >4,

Let vRequestBody = sthing1 ;

LIB CONNECT TO 'source';

do bla bla

" WITH CONNECTION(

BODY "$(vRequestBody)"

);

,

Let vRequestBody = sthing2 ;

LIB CONNECT TO 'source';

do bla bla

" WITH CONNECTION(

BODY "$(vRequestBody)"

);

)

but when I do this, It seems to be impossible (syntax error) :

see:

Capture.PNG

the question is, how can I do this otherwise?

1 Solution

Accepted Solutions
mwoolf
Honored Contributor II

Re: use of "if with let variables" within the script (syntax error)

if $(vNbr) >4 then

     Let vRequestBody = sthing1 ;

     LIB CONNECT TO 'source';

     do bla bla

     " WITH CONNECTION(

     BODY "$(vRequestBody)";

Else

     Let vRequestBody = sthing2 ;

     LIB CONNECT TO 'source';

     do bla bla

     " WITH CONNECTION(

     BODY "$(vRequestBody)";

EndIf

2 Replies
mwoolf
Honored Contributor II

Re: use of "if with let variables" within the script (syntax error)

if $(vNbr) >4 then

     Let vRequestBody = sthing1 ;

     LIB CONNECT TO 'source';

     do bla bla

     " WITH CONNECTION(

     BODY "$(vRequestBody)";

Else

     Let vRequestBody = sthing2 ;

     LIB CONNECT TO 'source';

     do bla bla

     " WITH CONNECTION(

     BODY "$(vRequestBody)";

EndIf

Partner
Partner

Re: use of "if with let variables" within the script (syntax error)

Shame on me !