How to run script continuously in perspective?

I have created a function and I want to run it continuously. Where should i call or write this function.

Scripts should never be run continuously. They should be event driven.

What are you trying to do?


Beginner/Learner here, I had a similar need and did this temporary work around.
Inserted a table > created a named query with polling rate 1 sec to keep the query running continuously. Once it satisfied my requirement, I re-sized it to a very small square shape and changed visibility to false in properties. Not the best practice but hope it answers your question.

That's probably what the OP needs.

A couple of points:

That named query isn't running continuously. It's running periodically. It does its job and terminates each time. That's the right way.

I don't understand this. Only components are visible. A name query isn't a component. It sounds like you created a component to hold the value of the named query but instead you should have created a custom property on the view and make the query binding on that.

3 Likes

copy that, I am not there yet (custom property), but will take note and try it.. Thank you for taking the time to share your expertise..

The custom properties are a very handy way of making variables available to all the components on your view. If you don't use them and you try to bind one component to another you wind up with a bunch of getSibling and getChild references which break if you rename components or move them into another container as the relative path has now changed.

If you use custom properties on the view you can bind your components to those instead. So, let's say you have a DateTime component selecting a date which will be used by something else:

  • Create a custom property "startDate"
  • Bind the DateTime's value property to that and make it bidirectional so that the DateTime can update the custom prop.
  • Now, anything that would have previously referenced the DateTime value should bind to view.custom.starDate instead.
5 Likes