Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Script line Error : if

Hi :

Can someone help me know what is wrong in my report?

Please find the attached error.

Script:

LET todaytime =  Date(Now(), 'dd');

LET Midstart = NUM(17,'00') ;

LET MidEnd = NUM(31,'00') ;

LET start = NUM(1,'00') ;

LET End = NUM(16,'00') ;

if  $(vToday) >= $(Midstart ) and $(vToday) <=$(MidEnd )

擷取.PNG

else if $(vToday) >= $(start ) and $(vToday) <=$(End )

擷取.PNG

thanks

kyoko

1 Solution

Accepted Solutions
maxgro
MVP
MVP

2 small example

LET vToday =  day(Now());

IF $(vToday) >= 17 and $(vToday)<=31 THEN

  trace '17..31';

ELSEIF $(vToday) >= 1 and $(vToday) <=16 THEN

  trace '1..16';

ENDIF;


and with variables


LET Midstart = 17;

LET MidEnd = 31;

LET Start = 1;

LET End = 16;

LET vToday =  day(Now())-10;

if  $(vToday) >= $(Midstart) and $(vToday) <=$(MidEnd) THEN

  trace '17..31';

ELSEIF $(vToday) >= $(Start) and $(vToday) <=$(End) THEN

  trace '1..16';

ENDIF;


View solution in original post

9 Replies
PrashantSangle

Hi,

go to Help Menu and see IF

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Not applicable
Author

HI @max dreamer

How can I go to "Help Menu" in this Community?

thanks

MK_QSL
MVP
MVP

Use ' ' when you call variable..


' $(vToday)'

abhaysingh
Specialist II
Specialist II

Hi Kyoko,

could you please tell me what you have define in vToday variable..

thanks

abhaysingh
Specialist II
Specialist II

it seems you have not define variable vToday thats why giving such error

Not applicable
Author

HI AbhaySingh

About "vToday"

LET ThisExecTimeDate =  Date(Now(), 'dd');

LET vToday = Num($(ThisExecTimeDate), '00');

Not applicable
Author

HI @MRKachhiaIMP :

when I use ' $(vToday)' .

擷取.PNG

maxgro
MVP
MVP

2 small example

LET vToday =  day(Now());

IF $(vToday) >= 17 and $(vToday)<=31 THEN

  trace '17..31';

ELSEIF $(vToday) >= 1 and $(vToday) <=16 THEN

  trace '1..16';

ENDIF;


and with variables


LET Midstart = 17;

LET MidEnd = 31;

LET Start = 1;

LET End = 16;

LET vToday =  day(Now())-10;

if  $(vToday) >= $(Midstart) and $(vToday) <=$(MidEnd) THEN

  trace '17..31';

ELSEIF $(vToday) >= $(Start) and $(vToday) <=$(End) THEN

  trace '1..16';

ENDIF;


Not applicable
Author

If your working with variables & varibales holds number use $(vName) or vName. If the variable holds string use '$(vName)'