Qlik Community

QlikView Deployment

Discussion Board for collaboration related to QlikView Deployment.

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

Reset variables at midnight

Hi,

I have a QlikView application which I reload at 1 a.m. every day. Sometimes it may be necassary to reload it during the day to get new data.

I want to trigger a different code if it is not the first reload on that day - so I need something like that:

11.07.2016

Midnight:   vReloadTimesToday = 0

1st reload at 1 a.m. results in vReloadTimesToday = 1

reload at 3 p.m. results in vReloadTimesToday = 2

12.07.2016

Midnight:   vReloadTimesToday = 0

1st reload at 1 a.m. results in vReloadTimesToday = 1

Is there a way to "reset" the value of the variable at midnight?

Thanks for your input.

Regards

Tamara

1 Solution

Accepted Solutions
MVP
MVP

Re: Reset variables at midnight

Maybe define your variable in your load script like

LET vReloadTimesPerDay = Rangesum(If(floor(Today(1)) = floor(ReloadTime()), vReloadTimesPerDay,0),1);

(if you need to start with zero, subtract 1:

LET vReloadTimesPerDay = Rangesum(If(floor(Today(1)) = floor(ReloadTime()), vReloadTimesPerDay,0),1)-1;

)

2 Replies
MVP
MVP

Re: Reset variables at midnight

Maybe define your variable in your load script like

LET vReloadTimesPerDay = Rangesum(If(floor(Today(1)) = floor(ReloadTime()), vReloadTimesPerDay,0),1);

(if you need to start with zero, subtract 1:

LET vReloadTimesPerDay = Rangesum(If(floor(Today(1)) = floor(ReloadTime()), vReloadTimesPerDay,0),1)-1;

)

t_witzgall
New Contributor III

Re: Reset variables at midnight

Hi Stefan,

first one helped a lot. Thanks!

If I use your seconds statement, QlikView won't count up - result is always rangesum(0,1)-1  = 0

Regards

Tamara

Community Browser