Tag expressions to replace Script functionality

Hi all,

I need to calculate the average value of a counter in the last 60 minutes.
I can't use gateway scripts nor scripts in the client.

Can this be done using tags with expressions? Is this doable? What things would I need to take into account?

What's the data source ? Is it a single tag with a single value, or do you have some history available ?

Hi Pascal,

No history available. Literally one OPC tag which reads the value of a counter.

I can create memory tags to store certain values (maybe use a dataset tag). But I can't use a script gateway.


May I ask why scripts are not an option ?

We cannot use gateway scripts as this job is for a client, and we do not have permission to access the gateway or modify anything in the gateway.

That shouldn't prevent using scripts, though ?
Even gateway scripts don't require you to actually access the gateway, it's all done from the designer.

Or did they specifically told you not to ?

They specifically told me I cannot use gateway scripts. That is why I'm looking for a different route to do this. I thought of using expression tags, but I don't know if this is doable. Any other options?

That's a very weird requirement...
It makes things convoluted and frankly quite more complex and less efficient than they should be.

I'm trying to think of a way to this cleanly...
Can you add your counter to the historian ?

No at this stage.

I can't think of a way to do this with built-in expression only...
Unless maybe using runscript and inlining the whole thing there.

At this point, I'd rather talk with the customer and tell them they can't expect nails to be hammered down if all they allow to do it is the use of waffles.

I can see this if they're reluctant to have all of their gateway scripts in a project restart. It can be a bit disruptive.

You could add a script to the OPC tag.

Can he, though ?

Depends if the customer has those tied up or not. :wink:

I did ask my colleague, not to use scripts in some places, since he is new to ignition.
With the help of expression tags, historical value statistics can be achieved to a certain extent. For example, 12 tags store the current value at 5 minutes, 10 minutes.... respectively. Add an expression tag for averaging. This means the statistics are not very precise.

Tag valuechange event handlers aren't technically gateways scripts. Gateway scripts, by definition, are only those housed in the same named section of the project :man_shrugging:

Edit: almost the same name... Scripting -> Gateway events

1 Like

But they require a gateway scripting project. I kinda doubt he'll be able/allowed to put scripts on the GSP if he can't make modifications to the gateway. And even if he could, I feel like the customer would tell him not to.

Yes they are, for any ordinary scope discussion. In particular, this sounds like an Edge project without the compute plugin. In which case tag events and tag expressions involving runScript will all fail, and you won't be able to include your own 3rd party module to implement the desired operation.

@Sam_Bermejo: go back to the client and tell them that particular task cannot be done without scripting. Full stop.