Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
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
vishsaggi
Champion III
Champion III

Try using LET

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


OR


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

m_woolf
Master II
Master II

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.