Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
rustyfishbones
Master II
Master II

Loop Through Sheets and Dates

Hi,

I have a file that loops through each sheet every 15 seconds, the dataset is nothuge sheets change every 15 seconds without any issues.

I have no user interaction and I always have 3 days of information.

So I need to loop through each sheet for each date

So example

Sheet 1 15/02/2017 15 seconds later......

Sheet 2 15/02/2017 15 seconds later.....

Sheet 3 16/02/2017 15 seconds later.....

Sheet 1 17/02/2017 15 seconds later.....

Sheet 2 17/02/2017 15 seconds later.....

Sheet 3 17/02/2017 15 seconds later.....

Sheet 1 18/02/2017 15 seconds later.....

Sheet 2 18/02/2017 15 seconds later.....

Sheet 3 18/02/2017 15 seconds later.....


Again, I am currently looping through the sheets, but I am not looping through the dates as I want.

I tried using sheet triggers on leave by adding a select in field of the date, but that does not work

Hope you can help.

Regards

Alan

1 Solution

Accepted Solutions
adamdavi3s
Master
Master

Hi Alan,


This is the best way I could find to do this.... I based mine on a 20second rotation due to simple laziness but you can build off it.

Sheet1 visible property  =right(Now(),2) <21

Sheet2 visible property  =right(Now(),2)>=21 and right(Now(),2) <41

Sheet3 visible property  =right(Now(),2)>=41


variable v_timer which is set to =Minute(now())



Then a trigger on that variable 'on change' to select the date:

=if(date(OrderDate+1) > date(max({1}OrderDate)),date(Min({1}OrderDate)),date(OrderDate+1))

View solution in original post

16 Replies
rustyfishbones
Master II
Master II
Author

I forgot to mention, once I have completed all sheets with all dates, I need to start the loop again.

Thanks

adamdavi3s
Master
Master

Hi Alan,

Can you share your app?

The sheet triggers should work, sounds a bit weird that it doesn't.

Are you using a macro to do the looping as someone else also had an issue with sheet triggers not working with a macro, seemed to be a timing issue as far as I could work out

rustyfishbones
Master II
Master II
Author

Hi Adam,

I cannot share the App unfortunately,I am not using macros and I want to avoid them.

I created a button that does a select in field and when I click it it changes the date, when I add the same select in field to the sheet trigger, nothing changes

I could create a counter variable, so for every 3 sheet changes the date would change, but again the sheet trigger is not working.

adamdavi3s
Master
Master

Hi Alan,

Not a problem at all, I appreciate that.

That is really weird, let me have a play and see if I get similar issues

adamdavi3s
Master
Master

Hi Alan,


This is the best way I could find to do this.... I based mine on a 20second rotation due to simple laziness but you can build off it.

Sheet1 visible property  =right(Now(),2) <21

Sheet2 visible property  =right(Now(),2)>=21 and right(Now(),2) <41

Sheet3 visible property  =right(Now(),2)>=41


variable v_timer which is set to =Minute(now())



Then a trigger on that variable 'on change' to select the date:

=if(date(OrderDate+1) > date(max({1}OrderDate)),date(Min({1}OrderDate)),date(OrderDate+1))

rustyfishbones
Master II
Master II
Author

Hi Adam,

The date is not changing, it's looping through the sheets alright, but the trigger on the variable is not changing the dates.

Is it changing for you??

Maybe I have disabled triggers somewhere on the document or AccessPoint??

What do you think

Alan.

rustyfishbones
Master II
Master II
Author

So the Date changes if I add it to a text box, but it does not select it in the field

2017-02-16_1137.png

adamdavi3s
Master
Master

Hi Alan,


Yep its definitely changing for me! Adding it to the sheet trigger didn't work as the sheet wasn't being 'activated' just 'shown'

I've checked it in webview and it doesn't work though, the sheets aren't even cycling so could be another V12 bug 😕