3 Replies Latest reply: Oct 13, 2014 7:53 AM by Massimo Grossi RSS

    Today()

    Laura Sébille

      Hello everyone,

       

      I have an application that calculates the delays of payement. For example, in my script, I have :

       

      let d=today();

       

      'day

      let jj= left($(d),2);

       

      'month

      let mm= mid($(d),4,2);

       

      'year

      let aa=right($(d),4);

       

       

      and then I create new variables in the script like :

       

      makedate($(aa), $(mm), $(jj)) - [Date_mvt] as delay

       

      and other one depending on today value.

       

      Now, I would like to run the Qlikview with on another date as "today".  I have tried to replace

       

      let d=today():

       

      by

       

      let d=today() - 200 ;

       

      (to be 200 days earlier) but I get the oracle error : literal does not match format string.

       

      How can I do to "change" today()'s value ?

       

       

      Thanks for your help

        • Re: Today()
          Jonathan Dienst

          Hi

           

          I think you have overcomplicated it.

           

               Today() - [Date_mvt] as delay

           

          should do just fine.

           

          If you want to snapshot Today() at an earlier point in the script, then

           

               Let vToday = Num(Today());

              

               and then in your load....

           

               $(vToday) - [Date_mvt] as delay

           

          HTH

          Jonathan

          • Re: Today()
            Ariel Klien

            Hi,

             

            Try let d=date(today() - 200);


            and for another issue...

            why do use 

                 'day

                 let jj= left($(d),2);

             

            and not let jj=day($(d))

                         let mm= num(month($(d)));

                         let aa=Year($(d));

             

             

            BR

             

            Ariel

            • Re: Today()
              Massimo Grossi

              small example

               

              let d=today();

              let d2=date(today()-100);

               

              load

                '$(d)' as today,

                '$(d)' - (makedate(2014)+rowno()) as delay,

                '$(d2)' as today2,

                '$(d2)' - (makedate(2014)+rowno()) as delay2

              AutoGenerate

                100;