One-Shot Expression

I am trying to create some information inside ignition - we typically do this in the PLC, but have a lot of remote sites and are trying to cut down on traffic where possible.

What I want to do is grab a start date and time when I get a run indication and then when I lose it grab a stop date and time. I was thinking of using an expression tag, but realized there really isn’t a way to do a one shot that is clean that I can think of.

Initially I though well I can use the expression tag to set another tag and run a script and as long as the other tag and the run status is high I don’t run the script, but when I lose the run and the other tag is high I run another script to grab the stop date. This just seems to convoluted to me, but I guess if it is the only way to do it. Anyone have any suggestion for a more elegant method?

Thanks

Would something like the attached tag structure work as a starting point? (tag export is from 7.5.8 )

A few notes:

-I don’t know if this kind of circular referencing is bad or not.

-I didn’t really pay attention to how run bit quality will affect the behavior (need to force run bit bad and see what happens when it goes good again)

-Before the initial tag change, the tags may evaluate to bad quality. A try call and default value may take care of it, but not sure what you’d want as a default.

Dan
ExampleSqltags.csv (2.46 KB)

In theory it is a great idea - I tried using it, but when I refer to the LastChange it always comes up null. If I just put a date instead of LastChange it comes up fine. Not sure what is happening there.

Thanks for the file though!

seems like a great use for the gateway tag change scripts. I guess it depends on what you want to do with the data? do you want to put it in tags or save it in the database?

Well a little bit of both, but I guess I could use a query tag to grab them out of the database. Thanks for the suggestion - I will look into it.

A triggered transaction group might also be a good choice for this sort of thing.