Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Show opening hours in map

Hello! I have a listbox with openingshours.

06.00-24.00

06.30-16.00

etc

etc

I want to make a green/red light if the current store is open right now.

So i will make a Gauge chart and change the look.

But it is possible to read the current time and check if the store i open and then have a green/red light if it open or not?

Thanks!

9 Replies
Anonymous
Not applicable
Author

Eric,

You can find current time using function now(), for example:

=timestamp(frac(now()), 'hh:mm:ss')

The problem with this approach is that the function checks time every second, hence consumes CPU.  You can use it with the parameter:
now(2)
In this case it shows time of the document opening.  No checking every second.

Regards,
Michael

Not applicable
Author

Yes i have found that. But how can i compare the current timestamp i have it in HH:MM,

And now i want to se if that is between the list box i have, as example 07.00-16.00

ljackson
Creator
Creator

If it was me, I would separate the times so you have an opening time dimension, and a closing time dimension.

Then, in the visual cues, you could write an expression (maybe an IF function), saying if 'now' is bigger than opening time, and less than closing time show as green.   If not show as red.

Not applicable
Author

Ok! I can for sure separate the times. So i have two dimensions.

time(Now(1)) gives me the current time in HH:MM.

So how can i write a if statement to check if the currenttime is between opening and closing hour?

A big thank you!!

Not applicable
Author

=if(time(now(1))>Open AND time(now(1)<Close, 1)

This is my guess, but that does not work

Anonymous
Not applicable
Author

Logic is correct .  It should work if the store is the dimension.

Can you upload an example of your application?

ThornOfCrowns
Specialist II
Specialist II

[MM] indicates a two-digit month of the year

[mm] refers to a zero-padded minute between 00 and 59

Not applicable
Author

=time(Frac(now(1)))>Open AND time(Frac(now(1)))<Close AND PRU = 'A' AND AREA = 'B'

I know have this expression.

But i want the graph to show for PRU A and AREA B without any choices in the listboxes, But this does not work 😕

ljackson
Creator
Creator

I'm guessing a little bit now, as I can't access my QV at the moment to test it, but I would say you need a expression similar to this:

=time(

          {$<Pru={'A'}, Area={'B'}>}

          Frac(now(1))>Open AND time(Frac(now(1))<Close

          )

The second line shows that for the selection, only show records where Pru=A and Area=B, from this data set the third line will calculate.

Hope that makes sense.

.