Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Today()

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

Tags (2)
3 Replies
MVP
MVP

Re: Today()

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

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
ariel_klien
Valued Contributor

Re: Today()

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

MVP
MVP

Re: Today()

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;

Community Browser