6 Replies Latest reply: Jan 22, 2016 2:17 AM by Anton Aleksandrov RSS

    multiple date selection in qlikview script

    vir vir

      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.

        • Re: multiple date selection in qlikview script
          Jonathan Dienst

          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.

            • Re: multiple date selection in qlikview script
              vir vir

              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
              Anton Aleksandrov
              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.
              • Re: multiple date selection in qlikview script
                vir vir

                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
                  Settu Periyasamy

                  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
                  
                  • Re: multiple date selection in qlikview script
                    mahamed khan

                    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.