Dynamic Timer on Perspective

I’m fairly new to Perspective and still learning best practices. To dip into it first, I’m redeveloping a Vision project to perspective. This project is a PDF/dashboard signage system. TVs around our plant can cycle through PDFs or other vision windows. The files and paths are all stored on a database that contains the TV the data is assigned to, the amount of seconds the data will be displayed before changing to the next row, and other various things.

My current planned design of this system on perspective is to, on the page being loaded, generate a dataset of files or views the TV has to display. In Vision, I used a timer component to control when the window would switch to the next row of data. The duration of the timer would be dynamically set on each new row of data within the ActionPerformed event. This can’t be replicated as there is no timer on Perspective.

image

To accomplish this on perspective, I’ve tried creating a custom property that is using a now() expression bound to another custom property. It is then is attached to a script transform which calls a python endpoint to get a link for an I-frame to display. I got this architecture up and running but ran into one major issue. In the script transform, I want write the {parent.custom.rotationRate} to the milliseconds of the display time of the new row of data, but this then immediately causes the script to refire continuously as the expression binding is being updated.

Would anyone have any suggestions on making the timing of the transform script dynamic? Do I have to use a busy wait to put the script in a holding pattern? Is there a more efficient way of creating a system like this? Thanks for any help with this.

The parameter in the now() expression is the frequency at which it will update the time so I am unsure if it is doing exactly what you are expecting it to. What I would do is on switch of a new row, take the duration and add it to the current timestamp and save that in its own custom property (let’s call it switchTimeStamp). Then check if now() > switchTimeStamp (maybe use a change script on the now() custom property and modify the param to have it check at your desired frequency). If the conditional is true then increment to the next row and again update the switchTimeStamp. Just an idea!

2 Likes

Did you come up with a good ‘Timer Solution’?

There are several ways to approach this.

Gateway Timer Event
Expression

What have you tried and what went wrong?

I have a scenario much like what the OP describes in his post. What I have tried was checking the forums to see if there happened to be a clever solution in place that would save me time and trouble.
I haven’t done anything but search the forum as of yet. I usually try that first if I dont have an available solution from the current toolbox of options.