Variable Page Component Threshold With Time


Recommended Posts

I have a page that displays the time when an alarm fires.  If there is no alarm, then the message is hidden.  Next to this message is another variable component that shows the elapsed time since the alarm fired.

If the alarm has been reset, then I want the elapsed time component to disappear, along with the alarm message..

 

When the alarm fires I save the system time to a channel called Event_1.  

 

The elapsed time is a variable Down_1 = systime() - Event[0].  When the alarm is reset I make Down_1 = 0

 

In my variable component on the page, I am able to hide the Event_1 (the time the alarm fired), but I cannot hide the elapsed time.

 

The variable component event expression is:    FormatDateTime("%H:%M:%p", Channel.Event_1(0)).  I set the threshold color for 0 to match the page color to hide it.  This works fine.

 

The elapsed time expression is:  FormatDateTime("%H:%M:%S", Down_1) .  It displays properly when Down_1 has a time in it, but I cannot hide it by setting the threshold to zero.

 

Is the threshold for a channel handled differently than for a variable?

Link to comment
Share on other sites

You shouldn't hide a component by making its color the same as the background.  Its technically not hidden.  For variable value components, use the Visible expression on the Size tab.  That's a completely independant expression from what the display expression is, so it can just be Down_1 == 1.  

 

As a side note: Not all components have a visible expression, in fact most don't, but all components have a visible member variable that allows you to hide/display components from script.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.