Trigger for executing Script at Factory studio

Dear Expert
I knew that the scripts in factory studio can be executed by 2 methods are Trigger and period.
With trigger Method, the scripts will be executed every time value of trigger change
Can I use logical condition as the trigger
Example: I have a Tag with type of integer. I want when the value of tag is greater 10, one script will be executed. If I assign this tag directly into trigger column of script, the script will execute many time because the value of Tag changes constantly.

Hi Manh,

Could you try to do this using this following documentation, please?

Using the IIF command you might be able to do that.

Let us know if it answer your question please.

Tatsoft Team.

Dear ser
I guess that IIF command is only used at code editor.
I tried it on Trigger field of task of script, it was not possible

Hi Manh,

We found another alternative for you.

First, you create a Task using the following code, it will verify if the tag value is over 10, and trigger a tag:
The tagTrigger is int datatype, if you are using Digital you could use like this, TK.Toggle(“@Tag.tagTrigger”);

Then in this Task you can use minimum 1 second period to trigger the task, or you can create a Timer tag to use in trigger if you want lower times

Finally you can use this tag @Tag.tagTrigger to trigger the task you wish.

Let us know if it solves the issue.

Tatsoft Team.