Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I'm quite new to qlikview and I have a strange result in my script
I try to compare two numbers in an "if" statement but I don't go inside the condition even if the condition seems true :
My first variable
TempMaxDate:
LOAD
Max (_comptaTimeStamp)as MaxDate
from $(vQVDPath)DATA_COMPTA.qvd (qvd);
Let vMaxQVDdate = Peek('MaxDate',0,'TempMaxDate');
Drop table TempMaxDate;
My second variable
Let vFileDate = num(date#(FileTime('$(file)'),'DD/MM/YYYY hh:mm:ss[.fff]'));
When I debug my code I get
But I don't enter in the if statement
Any Idea ?
Thank you
Try
IF vFileDate > vMaxQVDDate THEN
IMHO, using dollar sign expansion just adds potential issues with number literal formatting here (e.g. decimal separator needs to be a point for a constant number used in the script or expression). And using an implicit string interpretation / string comparison doesn't make it easier.
It should then also be enough to use
Let vFileDate = FileTime('$(file)');
Does this make any difference (not adding Num() function)?
If $(vFileDate) > $(vMaxQVDDate) then
.....
I get this message
How about this? Putting the expression within single quotes
If '$(vFileDate)' > '$(vMaxQVDDate)' then
Yeah !
It worked, thank you very much Sunny, Even if I don't understand why my first try was wrong ...
If I understand I'm comparing two strings with your method ?
To tell you the truth, I don't know what it's doing. May be someone else can guide us here
Try
IF vFileDate > vMaxQVDDate THEN
IMHO, using dollar sign expansion just adds potential issues with number literal formatting here (e.g. decimal separator needs to be a point for a constant number used in the script or expression). And using an implicit string interpretation / string comparison doesn't make it easier.
It should then also be enough to use
Let vFileDate = FileTime('$(file)');
Hello Stefan and thank you for your answer, you're right !
I removed the $ and everything is ok even with Let vFileDate = FileTime('$(file)');
Thank' again