Now(0) always return time in Tag expression

Hi
I define a tag expression with now(0) as expression.
The problem is the value of tag in update in every second with current time. When I set now(0) it should mean it only run only once. why my tag value update every second?
Even i try to use change scan class to 10 s but it always updated every second.

I can’t imagine it would be useful as a gateway tag. Did you try it as a client tag?

1 Like

I believe the poll rate of the now() expression tag only is meaningful within Vision scripts (not tags, in tags it follows the execution mode or scan class). EDIT: Also possibly Client Tags, @JordanCClark might be right on that.

I just tested this behavior under 8.0.2 with a tag configured with execution mode of “Tag Group” (so that it respects the configured Tag Group/Scan Class).

It was updating once per second as expected with the Default scan class. However, changing the scan class from Default to Slow (a Direct scan class I created with 10000ms rate) did not result in a change in update times. Only when I copied, deleted, and re-pasted the tag did it start to update at the expected 10000ms rate. This might be an issue in 8.0.2.

I also tested this under 7.9.12 with a similar tag configuration and changing the scan class and applying the changes to the tag had the expected results (tag updated per the configured scan class).

1 Like

It sounds like the tags scan class/tag group is overriding the now(0) .
There is similar behavior when using runScript() in tags.

snippet:


link: runScript()

I would look into using a different scan class/tag group for that tag(s) to suit your needs.

2 Likes

The scanclass triggler the now() if I use tag in gateway. Even with now(10000). Hope IA fix this bug.

Not a bug. Documented behavior. Same for runScript in a tag expression. There’s new functionality (that I haven’t used yet) in v8 that addresses this.

What would the use case be for using now(0) in the gateway?

I just try to create a timer event in tag change event with now(1000) for every second but it didn’t work so try now(0) to see if scan class really trigger the tag change event.


If the only driving factor in your expression is the now() function then setting the Execution Mode to Event Driven should make the expression in the tag poll at the rate set in the now() function.

5 Likes