Once you have your dataset from the query, you can rearrange through scripting.
In the attached window, I made a table with your example dataset, there’s a button to process it and display in another table, and another button to clear the results.
Here’s the meat of the script:
[code]# get input dataset
dataIn=system.dataset.toPyDataSet(event.source.parent.getComponent(‘Table In’).data)
This might look strange, but pyhton lets you iterate theough multiple lists in parallel.
The zip() function ties the lists together
for header, col, unit in zip(headersIn, row, units_list): #set timestamp value, otherwise, add to output data
if header == ‘t_stamp’:
ts = col
else:
dataOut.append([header, ts, col, unit])
I have added and manipulated all the data and have it writing to excel with the touch of a button.
I now need to automate it that it writes to file once a day - via gateway script I presume.
except I don’t seem to be able to access the window/table from the gateway script.
Window components are not accessible to the gateway.
The gateway script should be similar to what you have, you will just need to export the manipulated dataset to Excel directly instead of sending it to a table first.
Instead of a table using Tag History on a window, I used a query tag to get the data and then the gateway script accessed the tag and manipulated the dataset as required with your script.
Thanks again for your input as I had hit a brick wall up to that
Hey guys, was this application writing to an existing Excel file, or to a new one?
I’m trying to write tag data into an existing macro-enabled spreadsheet to a specific tab, and specific intervals. Have either of you dealt with this or know where I could get some direction on this? Or better yet, know someone who would like to be hired to handle the code for me?