Can a Gateway Schedule and its script be created in a Gateway Timer Script and/or vis versa. A timer script created in a Gateway Scheduled Script.
There's no way to programmatically create these event scripts, if that is what you mean. Otherwise, please elaborate on what you are trying to do (and why).
In my question I mean programmatically. What I am trying to do is - aiming to automate the creation of new entries in the SampleEvent
table based on the SampleSchedule
intervals. In a timer script I am running a named query to get samples that need to be taken from a schedule table. I go through the samples that need to be taken and based on the offset and interval in the schedule table, take these samples at a set interval until a status says not too. I know it could be done in one master script, but if I could create these schedules dynamically it would be more organized.
Sorry, not possible. I would run a scheduled event at one or five minute intervals (or slower--depends how precise you need to be) and queue up whatever operations have come due.
Thanks.
Can I define and use functions inside def onScheduledEvent() ? Or should they be defined in Scripting?
Can you? Yes, should you? No.
Create the functions you need in a Script Library. Then the script in onSchedultedEvent()
will be a single line call to some entry point into your function(s).