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

Qlikview If statement not working

Hi, I have a table with field batch id with many id including 20200523. So i want to do in such a way that if the count of test 2 is 1 because it is equal to test, then it will exit script. But seems like it doesn't work as it will continue on the else portion. 

 

let test = Date(20200523, 'YYYYMMDD');

LET test2 = (Count(if([BATCH_ID]= $(test), 1, 0)));

if test2=1 then
TRACE( Condition is valid);
EXIT Script;
ELSE

continue on the other part of the script

Labels (3)
11 Replies
DestinedTale
Contributor II
Contributor II
Author

Hi, still having the error. 

Syntax error

Unexpected token: '>', expected one of: '(', 'ZTestw_z', 'OPERATOR_PLUS', 'OPERATOR_MINUS', 'not', 'bitnot', 'LITERAL_NUMBER', ...

if >>>>>>><<<<<<1 then

 

The full code now is 

 

let test = Date(today()-1,'YYYYMMDD');


tmp:
load count(BATCH_ID) as Ctmp resident BAD_TPUT where BATCH_ID=$(test);

LET test2 = FieldValue('Ctmp',1);;

drop table tmp;

if $(test2)>1 then
trace --- buzzz ----;
Exit script
else

Taoufiq_Zarra

let test = Date(today()-1,'YYYYMMDD');


tmp:
load count(BATCH_ID) as Ctmp resident BAD_TPUT where BATCH_ID=$(test);

LET test2 = if(isnull(FieldValue('Ctmp',1)),0,FieldValue('Ctmp',1));

drop table tmp;

if $(test2)>1 then
trace --- buzzz ----;
Exit script
else

 

or share your file

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉