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

Differents results for a same script - weekday() today() functions - Batch mode

Dear all,


I need to run a script every wednesdays, therefore I used function weekday and today.


Below a script's extract:
LET Jour_Semaine_LIB=weekday(date(today(0),'dd'));
LET Jour_Semaine=num(weekday(date(today(0),'dd')));

trace 'Jour de la semaine : ' $(Jour_Semaine_LIB);

Directory;

//if Wednesday
if  $(Jour_Semaine) = 2 then

This script is scheduled to run everydays at 08:30am.
This has been done through the QlikView Web server application.

---

  • This morning (it is wednesday) I have curious results in the log :

04/04/2012 08:32:24: 0053  LET Jour_Semaine_LIB=weekday(date(today(0),'dd'))
04/04/2012 08:32:24: 0054  LET Jour_Semaine=num(weekday(date(today(0),'dd')))
04/04/2012 08:32:24: 0056  trace 'Jour de la semaine : ' tuesday

04/04/2012 08:32:24: 0056  'Jour de la semaine : ' tuesday

04/04/2012 08:32:24: 0060  Directory
04/04/2012 08:32:24: 0063  if  1 = 2 then


  • So I rerun manually the script through the QlikView Web server application and have the following log :

04/04/2012 08:34:49: 0053 LET Jour_Semaine_LIB=weekday(date(today(0),'dd'))
04/04/2012 08:34:49: 0054 LET Jour_Semaine=num(weekday(date(today(0),'dd')))
04/04/2012 08:34:49: 0056 trace 'Jour de la semaine : ' wednesday

04/04/2012 08:34:49: 0056 'Jour de la semaine : ' wednesday
04/04/2012 08:34:49: 0060 Directory
04/04/2012 08:34:49: 0063 if  2 = 2 then


  • I rescheduled the same script at 08:45am the same morning (nothing else changed except the time of schedule) and now I have :

04/04/2012 08:45:02: 0053  LET Jour_Semaine_LIB=weekday(date(today(0),'dd'))
04/04/2012 08:45:02: 0054  LET Jour_Semaine=num(weekday(date(today(0),'dd')))
04/04/2012 08:45:02: 0056  trace 'Jour de la semaine : ' wednesday

04/04/2012 08:45:02: 0056  'Jour de la semaine : ' wednesday

04/04/2012 08:45:02: 0060  Directory
04/04/2012 08:45:02: 0063  if  2 = 2 then


I do not know what happens here. It seems that batch mode does not execute correctly the today function.

Many thanks in advance for your help,


Gilles

1 Solution

Accepted Solutions
Not applicable
Author

today(0) must be used.

View solution in original post

1 Reply
Not applicable
Author

today(0) must be used.