First let me say im not a pro at scripting,
with that said, I have created a button that the operator uses to save a table trend.
we use 2 different popup calendars to choose the begin date and end date of the table trend. which is usually the last 24hrs. 8am day before till 8am today.
here is the script I have for the button.
table = event.source.parent.getComponent(“Table”)
data = table.data
csv = system.dataset.toCSV(data)
file = system.file.saveFile(“Save File Name”, “csv”, “Comma Separated Values”)
if file:
system.file.writeFile(file, csv)
My Question is how to auto save a Table from 8am day before to 8am day now.?
also give it a new saved name each day. (date and time is fine for file name)
I have started a Gateway Event script (scheduled) with the settings set for every day at 8am.
But cant seem to figure out the script to auto save.
this is what I have so far. ( any example scripts or help would be great)
def onScheduledEvent():
“”"
A scheduled script that will execute periodically on the gateway.
"""
##Line 1 can not be edited it is default script##
def onScheduledEvent():
table = event.source.parent.getComponent("Table")
data = table.data
csv = system.dataset.toCSV(data)
file = system.file.saveFile("Export to excel file name", "csv", "Comma Separated Values")
if file:
system.file.writeFile(file, csv)