Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
qliklearnervir
Creator
Creator

multiple date selection in qlikview script

HI,

IN our current project i have to build one scenerio in qlikview script :

When  our  loading date = today() than i have to pull the  data for arrival date from today() to last 3 days like today()-1,today()-2,today()-3,

and want to set a flag for the same.

6 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

You need to provide more information about where you are loading from. Are you loading from a csv, excel file, database etc. What is the name of the data field, or are the files date stamped, etc, etc.

Without that information, any answer that I give you can never be better than a guess.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
asgardd2
Creator III
Creator III

If I understand you correctly...
You need to create a variable in the script
LET vLoadingDate = today() - 3;
After, when loading data from  data source, if the table has a date field, you can add a new field, like "flagLastThreeDays "

IF(Date >= $(vLoadingDate) , 'X',' ') as flagLastThreeDays

It is better if you posted an sample in qvw format.
qliklearnervir
Creator
Creator
Author

Hi ,

Previously i have loaded the code accordingly :

LOAD

ID,

Arrive_date,

book_date,

departure_date,

if(departure_date=today(),1,0) as flag_today,

if(departure_date=date(today()-11,'DD/MM/YYYY'),1,0) as flag_remind

resident guest;

Now as per current scenerio i have to change my loading mechanism as per below :

(1)  if departure_date =today() and weekday=Monday THEN  i have to ick last 3 days data like today()-1,today()-2,TOday()-3..............for other days i have to pick one day older data like today()-1........

and  have to maintain the flag also.....................

qliklearnervir
Creator
Creator
Author

Hi ,

Previously i have loaded the code accordingly :

LOAD

ID,

Arrive_date,

book_date,

departure_date,

if(departure_date=today(),1,0) as flag_today,

if(departure_date=date(today()-11,'DD/MM/YYYY'),1,0) as flag_remind

resident guest;

Now as per current scenerio i have to change my loading mechanism as per below :

(1)  if departure_date =today() and weekday=Monday THEN  i have to ick last 3 days data like today()-1,today()-2,TOday()-3..............for other days i have to pick one day older data like today()-1........

and  have to maintain the flag also.....................

settu_periasamy
Master III
Master III

May be like this..

LET vDate = num(today())-3;

if WeekDay(Today())='Mon' then

  Table:

  Load Fields from Source.qvd (qvd) where YourDateField > $(vDate);

ELSE

  Table:

  Load Fields from Source.qvd (qvd) where YourDateField > Today()-1;

ENDIF

Mahamed_Qlik
Specialist
Specialist

Hi Vir,

Create the variables :

1) For Today() -    vToday=Today()

2) For last 3 days - vLast3= Today()-3

Then to go document properties---> select trigger----> in first box (Document Event Triggers) select OnOpen--->Click on Add action-->click on Add ---> select External--->set variable--ok

--Put the Arrive_date in variable without Equal to sign(=) and put the variable vLast3 in value. then -->ok

Hope this willl help

Regards,

Mahamed.