Perspective script binding refresh interval

Hello,
I'm trying to create a perspective table that lists all running SFCs. However, I haven’t found a good way to do this yet, so I’m posting here in the hope that someone can point me in a better direction.

As a workaround, I created a query binding for the table’s data property. The query itself is just a dummy one (SELECT 1 works on my PostgreSQL). The reason I’m using a query binding is that it allows me to set a polling interval. Then I apply a script transformation, which returns the running SFCs using system.sfc.getRunningCharts function.

I don’t think there’s a better function than system.sfc.getRunningCharts, but it feels strange to use a query binding just to run a script at regular intervals. Is there a cleaner way to achieve this?

Try an expression binding:
now(3000)

2 Likes

Or better yet, avoid a transform altogether and place the script into a library function you can call with an interval set in a runScript expression (the pollRate parameter).

4 Likes

Thank you both, I totally missed these expression functions.

runScript("system.sfc.getRunningCharts", 3000) works.

1 Like

And thank you, I didn’t realize runScript could directly invoke system functions, but I guess it makes sense.

I always try to avoid script transforms in favor of runScript ever since I learned that they actually execute faster.