lastUpdated for gauge blocks

It would be great to have the {{lastUpdated}} variable available in gauge block conditions. As far as I know its only available in indicator blocks.

Hi Paul,

I will make a ticket for this with our engineers.

Have a great day!
Julia

Thanks @JuliaKempf

I presume a workaround could be to pass down an update time on a device attribute from a workflow through a context variable on a dashboard to then use in a gauge block (or any block)?

FYI, I have implemented a work around by defining an attribute “Update_Time” which is saved to the device state via a workflow. A second workflow then looks up the Update_Time when the page is loaded and passing this down as pageData to be used as a context variable in a dashboard page.

This works just except for one fatal flaw: the Update_Time will only be refreshed into the context variable once the whole page is reloaded thus triggering the work flow.

Is there any way to approach this in the absence of having updateTime available in dashboard gauges?

Hi @paul_wareham,

Just want to clarify, you said above that the Update Time is set in the device’s state and stored there. While your context variable is set by the workflow, if you were to display the Update_Time device attribute, it would update with each dashboard refresh (or data fetch). You can manually set the refresh time of your dashboard as well. Are you unable to use the Update_Time attribute?

Thanks!
Julia

@JuliaKempf No I am able to use the Update_Time attribute by passing it from my workflow through pageData and a context variable (Number type). But the value will only refresh on the dashboard when the page is reloaded in the browser. I’m using an Experience page of the Dashboard type.

The attribute value doesn’t get passed down to the dashboard until the page is loaded which triggers a workflow to query the attribute and then respond.

Hi Paul,

I understand the problem now, thanks for your patience! :grinning: I will create a feature request. In the meantime, there is an option if you would like the Update_Time variable to refresh on the dashboard.

I saw that you had a label on your gauge block that utilizes ctx.Update_Time, but since it is in the label and a context variable, it will not live update. Though it may not be ideal, you would be able to display that time and have it update if you were to use the attribute instead of the context variable. This would mean creating a new dashboard block to display the Update_Time variable, but the deviceID is your context device:

This will allow that time to live update on the dashboard like any other attribute, and it will still switch to another device when the deviceID context variable is changed. This may not be the ideal path for you as {{lastUpdated}} is available in the Indicator Block, but it is a way to get that time attribute on the dashboard and have it refresh.

Let me know if this option works for your use case!

Have a great day,
Julia

Thanks @JuliaKempf

Would using the attribute update the entire dashboard so that the context variable Update_Time would also update? In other words, what if I used both approaches at the same time in order to force an update of the context variable?

Thanks

Paul

Hi @JuliaKempf

I just wanted to clarify how that workaround would handle the entire dashboard as per my question above,

Thanks!

Paul

Hi Paul,

There is not currently a way to refresh the context variable unless the page is reloaded, so this would not force an update. Using the attribute in place of the context variable is the only way to refresh the value.

Thanks!
Julia

ok thanks @JuliaKempf that’s what I thought.

What is underneath this is my need to clarify the status of gauges on a dashboard page (under experience). Our users are getting confused with old data which they don’t initially notice is “8 days ago” for example. I thought I would at least be able to place some text in the title bar that would have the last dated updated along with a warning as such. Even better, my thought was to change the color of the dial gauge to light gray to signify that its old data.

To date, the only measure I’ve been able to implement is to have an indicator box to calculate when the unit is “offline” and provide a warning for the overall page, but I feel this is still not clear enough.

I was wondering if anyone on the forum might be able to think of other clever ways around this? I was thinking perhaps to use a workflow to force the gauge value to -1 or something nonsensical and use that as a trigger turn the gauge color.

Paul