Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Our next Qlik Insider session will cover new key capabilities. Join us August 11th REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
CNH_1978
Contributor II
Contributor II

If statement in script to compare QVD save date

Hi, Can anyone tell me what is wrong with this script please?

let vQVDPath = 'C:\Users\User1\Desktop\';
let vToday = date(today(),'DD/MM/YYYY');

let vQVD_Date = date(QvdCreateTime('$(vQVDPath)TestQVD.QVD'),'DD/MM/YYYY') ; \\ only added to confirm date

if date(QvdCreateTime('$(vQVDPath)TestQVD.QVD'),'DD/MM/YYYY') = $(vToday) then

SET vResult = Yes;

ELSE

SET vResult = No;

ENDIF;

 

I am trying to compare todays date with the save time of the QVD, if the date matches then output YES otherwise output NO. 

It seems to output NO even though the dates match (as seen below..

CNH_1978_0-1596731041205.png

 

Many thanks in advance

1 Solution

Accepted Solutions
hopkinsc
Partner
Partner

Hey,

I think the QvdCreateTime() function will return a timestamp, so try and wrap it in the left() function..

if left(date(QvdCreateTime('$(vQVDPath)TestQVD.QVD'),'DD/MM/YYYY'),10) = '$(vToday)' then

I think that should work. 

Cheers

View solution in original post

4 Replies
fosuzuki
Partner
Partner

Hi,

Try changing your if to:

if date(QvdCreateTime('$(vQVDPath)TestQVD.QVD'),'DD/MM/YYYY') = '$(vToday)' then

(put single quotes on vToday)

CNH_1978
Contributor II
Contributor II
Author

Hi, thanks for your reply. 

Unfortunately, single quotes didn't fix it either. 

I have attached the QVW i am using. 

hopkinsc
Partner
Partner

Hey,

I think the QvdCreateTime() function will return a timestamp, so try and wrap it in the left() function..

if left(date(QvdCreateTime('$(vQVDPath)TestQVD.QVD'),'DD/MM/YYYY'),10) = '$(vToday)' then

I think that should work. 

Cheers

View solution in original post

CNH_1978
Contributor II
Contributor II
Author

Fantastic, that is working. 

Thanks!