I am using ignition Edge and trying to add script to a button such that when the button is pressed it takes the present time(startTime) and adds X minutes to it (endTime) which will be obtained from the dropdown on the screen. Now it keeps waiting for X minutes and then generates a CSV file of the data selected betwwen these two times, also during this time I want to show a popup which can show remaining time and to cancel the operation.
it is purely for collecting the test data coming from the PLC . I have other script that can pull data in between Now to X minutes backwards - the purpose is to provide them both options they can start a test for X minutes and once the time has elapsed save data to CSV file and the other option is to pull the data backwards
one, an expression that checks if the timer active’s timestamp when it turned on + selected time period is greater than the current time. Add an onChange script to it which does your csv export stuff if it’s not initialChange and current value is True
The TimerActive tag is needed to stop the now() from executing all the time, at least I think this will stop it… you can also increase the update rate
Also, completely untested.
there is an error, I am new to python scripting
Do I need to set timeractive to true as well when the button is hit
I also tried to pass the minutes to the client tag
You need to read client tags with system.tag.readBlocking and write using writeBlocking
Also, all of that script should be in the log trigger client tag’s tag change event script. You want the csv to be generated by the tag change script so that it doesn’t lock up your gui
Ah, you need the compute module to do any gateway scripting or tag events.
If that’s not an option, then I would use system.util.invokeAsync to run your code in your original button, so that again, it doesn’t lock up your gui.