Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
Not applicable

Inaccurate date load

Hello all,

I am trying to load in some data from a database, but only up to and including the previous day (yesterday). The current line in the script to get yesterday's date is:

Set PullDate = Today(Now(1))-1;

This app runs automatically every day at 6:15 AM in QMC and stores the data into a QVD, but each day it does not pull in the correct date for yesterday, but instead pulls in the date for two days ago. So something is not updating correctly here.

When I manually run the QMC job again about 15 minutes later, the data in the QVD is accurate, and the PullDate is indeed equal to yesterday's date.

Any ideas on why this is happening?

Thank you.

2 Replies
Highlighted
Esteemed Contributor III

Re: Inaccurate date load

Try using LET

LET vPullDate = Today(Now(1))-1;


OR


LET vPullDate = Date(Today(Now(1))-1);

Highlighted
Honored Contributor II

Re: Inaccurate date load

You are tring to use a timestamp as the argument for the today() function.

This is from Help:

today([timer_mode] )

Returns the current date from the system clock. The timer_mode may have the following values:

0 Date at script run
1 Date at function call
2 Date when the document was opened  

Default timer_mode is 2. The timer_mode = 1 should be used with caution, since it polls the operating system every second and hence could slow down the system.