Accessing dashboard time

Hello!
Simple question: how do I properly access the set dashboard time? I’m trying to do this in an input control button:
input

But the payload result is:
output

Thanks in advance!

Currently the Input Controls Block will only pass through static defined values, and values that are reflected in the form elements within the block - but I think what you are asking for here is reasonable to expect. I will file a feature request to allow for passing in values from the dashboard properties, including the current dashboard time. Thanks for the feedback.

1 Like

What you can do in the meantime is add a text input to the block and set its default value to {{dashboard.time}}, which will then print the time value in milliseconds in the input. But that wouldn’t stop users from changing that value when pressing the button.

Hi @Cesar_Guedes ,

Just wanted to follow up on this thread. With our most recent platform update, the Input Controls Block can now pass in values from dashboard properties, including {{dashboard.time}}.

One consideration though - {{dashboard.time}} will only return a value if the dashboard is viewing a past state. Therefore, if no value is returned, we can assume that the current payload’s time value is the same as the dashboard time.

In a workflow, you can use the defaultTo and formatDate format helpers to evaluate if a value was returned by {{dashboard.time}}, and use the current payload’s time value if not. For example, if your Input Controls Block is storing {{dashboard.time}} as data.dashboardTime, you could use the following expression in a workflow node:

{{defaultTo data.dashboardTime (formatDate time 'x')}}

Thanks for bringing up this feature request! Let me know if you have any questions.

1 Like