Hi, I have a transformer that tells me the hours of the day so far. For example, if it's 1:01 AM, it would return 0,1. And similarly if it's 2:05 AM it would say 0,1,2.
I use the result of this transformer in a parameter to an API and then transform the result to show in a table.
The problem is that even after I re-trigger my APIs, they read the stale value of the hours transformer. The state inspector in the bottom bar also shows updated values for the transformer but the API still uses the old ones.
I don't think the transformer will refresh until the data it uses changes, which would need to be triggered by something. I don't know what your original data is, a query of some kind?
Have you tried going to the advanced tab of the query the transformer is acting on, and setting it to "Run this query periodically", with a refresh value that works for your use case?
Hi Mike, my transformer is current time based, so my understanding suggests it should update automatically with time, pls correct me if I am wrong. I have used my transformer values in this API. Rerunning the API uses stale values of the transformer.
As mentioned @MikeCB , the transformer won’t automatically refresh unless the underlying data changes — and that’s absolutely true.
To work around this, I tried another approach for showing the current date and time with seconds updating live (like a clock). I used a small JavaScript query along with a temporary state variable.
variable8 is just a temporary state variable (default value = null).
For testing, I bound it to a text input to display the date and time, and it updates perfectly every second.
After this, your transformer code will work correctly. For example, you can use the live-updating variable to calculate the start of the day like this: