Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Compare two variable of time...

Hello!

I try to compare two variable  in the loading script. Current time must fall within a specified time interval

My script:

let vTimeStart = '05:00am';

let vTimeEnd   = '05:30am';

let curTime    = time#(time((num#(Left(now(1),4))/2400),'hh:mmtt'),'HH:MMTT');

if time('$(curTime)','HH:MMTT') >= time('$(vTimeStart)', 'HH:MMTT') and (time('$(curTime)', 'HH:MMTT') <= time('$(vTimeStart)', 'HH:MMTT')) - error in this row

  //some script

endif

Thanks!

Tags (1)
1 Solution

Accepted Solutions
kumarnatarajan
Valued Contributor

Re: Compare two variable of time...

hi,

try this.

Ex;

let vTimeStart = Timestamp(Timestamp#('05:00am','hh:mmtt'),'hh:mmTT');

let vTimeEnd   = Timestamp(Timestamp#('05:30am','hh:mmtt'),'hh:mmTT');

let curTime    = Timestamp(now(),'hh:mmTT');


if '$(curTime)' >= '$(vTimeStart)' and '$(curTime)' <= '$(vTimeStart)' then
set vCondition='True';
ELSE
set vCondition='False';
endif

2 Replies

Re: Compare two variable of time...

let vTimeStart = time#('05:00am','hh:mmtt');

let vTimeEnd  = time#('05:30am';'hh:mmtt');

let curTime = frac(now());

if $(curTime) >= $(vTimeStart) and $(curTime) <= $(vTimeEnd) then

     // true

else

     // false

end if;


talk is cheap, supply exceeds demand
kumarnatarajan
Valued Contributor

Re: Compare two variable of time...

hi,

try this.

Ex;

let vTimeStart = Timestamp(Timestamp#('05:00am','hh:mmtt'),'hh:mmTT');

let vTimeEnd   = Timestamp(Timestamp#('05:30am','hh:mmtt'),'hh:mmTT');

let curTime    = Timestamp(now(),'hh:mmTT');


if '$(curTime)' >= '$(vTimeStart)' and '$(curTime)' <= '$(vTimeStart)' then
set vCondition='True';
ELSE
set vCondition='False';
endif

Community Browser