Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hi,
i have an if statement that i use whereby it will fail the app on purpose if the max date is <= the time of a different qlik app.
however, for some reason the app is not failing and i cant understand why.
my if statement:
//if max date of source files is less than the date of report late reload – 10 minutes then no need to reload the qlikview report
if maxdate<= num($v_NUM_File_Date-10/1440) then
drop table Nonexistabtable;
end if
//dropping a table which does not exist causes the qlikview report to error
and when i put the maxdate and $v_NUM_File_Date in a text object i get the following:
surely based off the above this app should fail? however it is not its running fine.
any ideas?
thanks
MaxDate could be a field rather than a variable, in which case you could use it in the front-end but not in the control statement. Why are you using MaxDate when you appear to already have a vMaxDate set?
Run your app in debug mode, step by step, and you should be able to see the flow and the variable values and figure out what it's doing. One thing I'd look at is to keep the types consistent, so if you're going to num() one, you should num() the other, but that might not be related at all, just good practice in general.
hi @Or , yes i have them kept at num in my script and have gone through debug mode, it appears that it just skips the "drop table Nonexistabtable" completely
i went to debug and it looks like it has a null for the maxdate? am i reading it correctly? is that why my if statement is not working?
how could it be null in the if statement but once the app opens, there is a maxdate in there?
MaxDate could be a field rather than a variable, in which case you could use it in the front-end but not in the control statement. Why are you using MaxDate when you appear to already have a vMaxDate set?
i was using a field as i was concatenating two different max dates together. however as you suggested, i just made it a variable using let vMaxDate2 = peek('maxdate') and it worked!
thanks so much for your help i didnt know you couldn't use a field in control statement in script!