Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

qliklearnervir
New Contributor III

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
MVP
MVP

Re: multiple date selection in qlikview script

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
Contributor III

Re: multiple date selection in qlikview script

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
New Contributor III

Re: multiple date selection in qlikview script

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
New Contributor III

Re: multiple date selection in qlikview script

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.....................

Re: multiple date selection in qlikview script

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

mahamedfaijan
Contributor II

Re: multiple date selection in qlikview script

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.