Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I need some help with this. I have 5 Sheets on my Qlikview document and what I want is to change each sheet each 30 seconds, Can you help me with this. I tried with the example here in the qlikview web (Dynamic Sheets = the sheet turn every 10 seconds), but I cant get results. If Anybody can help me with this... Thanks in advance...
Pablo
Do you mean that you want the model to cycle through the five screens, changing every 30 seconds - for a large screen display (in for example a call centre)?
If so, you can use this approach:
=ceil((frac(now())*86400/(vSheets*vDelay)-floor(frac(now())*86400/(vSheets*vDelay)))*(vSheets))
vShow=1 (for the first sheet)
vShow=2 (for the second sheet, and so on)
The vShow variable expression will return the value 1, then after 30 seconds, the value 2 etc, causing the displayed sheet to change every 30 seconds.
Hope that helps
Jonathan
Hola Pablo,
can you explain how you want to change each sheet each 30 seconds? Can you post the link about qlikview web dynamic sheets that turn every 10 seconds?
Saludos
Luca
Hi Pablo,
This sounds like only a macro can achieve this. I don't know of anyhow native functionality or parameter allowing dynamic change of sheets based on time. It would be a nice future feature in QV.
Hopefully someone has done this with macros. I also have a client that is interested in this feature for an LCD display of QlikView on a shop floor.
Pablo
Do you mean that you want the model to cycle through the five screens, changing every 30 seconds - for a large screen display (in for example a call centre)?
If so, you can use this approach:
=ceil((frac(now())*86400/(vSheets*vDelay)-floor(frac(now())*86400/(vSheets*vDelay)))*(vSheets))
vShow=1 (for the first sheet)
vShow=2 (for the second sheet, and so on)
The vShow variable expression will return the value 1, then after 30 seconds, the value 2 etc, causing the displayed sheet to change every 30 seconds.
Hope that helps
Jonathan
Hi Jonathan,
Superb. Thank you for that methodology.
First of all Thank you all for your answers.
I'm Going to use the macro that you indicated Jonathan. And I will comment you the results. Thanks
I Attached the example with dynamycs sheets. The idea is to change the time in the sheets. The division I made by 30. But just took 2 sheets. It must be because the value on function Floor must be changed. But I can´t get possitive results.
Thanks Again
Pablo,
I recommended avoiding function now(), except in the load script.
There is an alternative way which I used in QV 7x (didn't have requirements like that later). Two variables:
Rotations: Number of cycles (gives your flexibility, and very useful for testing)
Delay: Delay on sheet, in seconds
The macro is approximately like this:
sub Rotate
on error resume next
set r=ActiveDocument.Variables("Rotations").GetContent
set d=ActiveDocument.Variables("Delay").GetContent
d=d.string*1000
for i = 1 to r.string
ActiveDocument.Sheets("Sheet 1 name").Activate
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.GetApplication.Sleep d
ActiveDocument.Sheets("Sheet 2 name").Activate
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.GetApplication.Sleep d
ActiveDocument.Sheets("Sheet 3 name").Activate
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.GetApplication.Sleep d
next
end sub
The attached example is a little more complicated than you need, in that different tabs stay active for different amounts of time. It uses no macro code or actions, just display conditions for each tab sensitive to the current time. Tested in v9 and v10.
Michael, I consider it safe to use now() in this case. Now() polls the operating system once per second. If you're only doing that once per second per tab, that should be a pretty trivial amount of CPU. You have to be very careful with how you use now(), but there are cases where I think it is appropriate. This is one of those cases.
(Edit: It looks like this is almost the same as Jonathan's solution. Maybe I can combine them in an even more efficient way since he only checks now() once per second, not once per second per tab. Hmmm.)
Thanks John that is exactly what I needed. I just have to change the values on the inline table to 30 seconds.
Thank you all.
OK, I think I've integrated Jonathan's approach into my example, but still allowing for different timing for each sheet. I believe now() will only be evaluated once per second this way. We generate variables from the inline table, but don't actually store the data, so it won't interfere with the data model in any way.
Here's the script:
[Timing]:
LOAD
recno() as Tab
,rangesum(Seconds,peek(Seconds)) as Seconds
INLINE [
Seconds
20
10
5
];
[Show]:
LOAD
'=' & concat('if(vSeconds<' & Seconds & ',' & Tab,'
,') & repeat(')',max(Tab)) as Show
,'=mod(round((now()-now(2))*86400),' & max(Seconds) & ')' as Seconds
RESIDENT Timing;
LET vShow = peek('Show');
LET vSeconds = peek('Seconds');
DROP TABLES [Show], [Timing];