Support Forums
Script to execute only once out of all instances

Hi, I have used script in a page to increase tag value by one based on some conditions. Now that particular page is being viewed from multiple thin client a time.

is there any chances that script will execute multiple time based on instances ?

if yes How can I avoid it ?

Hi, I have used script in a page to increase tag value by one based on some conditions. Now that particular page is being viewed from multiple thin client a time. is there any chances that script will execute multiple time based on instances ? if yes How can I avoid it ?

Yes, You should probably move the script into either a Multi-write (Ideal if it is relativley simple) tag or a module.

Yes, You should probably move the script into either a Multi-write (Ideal if it is relativley simple) tag or a module.

Trihedral Engineering Ltd.

If I am writing a module that will increase tag value by one (e.g. X=X+1) based on some condition. that condition is defined in the page. That page is being viewed by multiple thin client instances. If condition in the page is true and module is triggered to increase the tag value then, Will every instances of that page will call that module to increase tag by one? if so instead of tag value should be increase by one it will be increased by multiple of number of that page instances ?
SO is there any way that script block execute only once irrespective of number of instances of the page that calling ?

If I am writing a module that will increase tag value by one (e.g. X=X+1) based on some condition. that condition is defined in the page. That page is being viewed by multiple thin client instances. If condition in the page is true and module is triggered to increase the tag value then, Will every instances of that page will call that module to increase tag by one? if so instead of tag value should be increase by one it will be increased by multiple of number of that page instances ? SO is there any way that script block execute only once irrespective of number of instances of the page that calling ?

Could you please define the trigger more clearly? Does the simple act of opening the page increase the tag value? If so then yes, your script will run every time the page is opened.
If it's something else that just happens to be visible on the page, then it depends on what that thing is.

Could you please define the trigger more clearly? Does the simple act of opening the page increase the tag value? If so then yes, your script will run every time the page is opened. If it's something else that just happens to be visible on the page, then it depends on what that thing is.

Checking back in.
Perhaps the OP has solved the problem another way, but for anyone else monitoring the thread....
It occurs to me to wonder, why is the code being added to a page if the trigger relates to a tag? Perhaps a Script Tag would be a better option?
https://www.vtscada.com/help/Content/D_Tags/Dev_ScriptTags.htm

Checking back in. Perhaps the OP has solved the problem another way, but for anyone else monitoring the thread.... It occurs to me to wonder, why is the code being added to a page if the trigger relates to a tag? Perhaps a Script Tag would be a better option? https://www.vtscada.com/help/Content/D_Tags/Dev_ScriptTags.htm
119
4
3
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft