Code is here,
def runAction(self, event):
import json
tagPaths = []
aggregateModes = []
histPaths = []
self.view.custom.Saving = True
array = self.view.params.Pens
for row in array:
rowObj = row['data']
if rowObj['aggregateMode'] == "default":
aggregateModes.append(self.view.params.DefaultAggregationMode)
else:
aggregateModes.append(rowObj['aggregateMode'])
histPaths.append(rowObj['source'])
for histPath in histPaths:
tagPaths.append("[default]" + str(histPath).split("tag:")[1])
points = self.view.custom.Points
endTime = self.view.params.EndDate
startTime = self.view.params.StartDate
data = system.tag.queryTagHistory(paths=tagPaths,startDate=startTime, endDate=endTime, returnSize=points, returnFormat='Wide', aggregationModes = aggregateModes)
csv = system.dataset.toCSV(data)
filePath = system.perspective.download("chopper_use_time.csv", csv, "Comma Separated Values")
self.view.custom.Saving = False
It should have 2 columns of data showing when is the machine running. I wanted to have the time when tag value is 0 (false), and the time when tag value is 1 (true), but only time_stamp is showing, and it's just time, not the time when there is a feedback from tag.
Can you show the actual csv? Open in notepad or similar and then paste the top few rows.
Excel does things that you may not expect to imported text files and the data that is shows may not match the actual data.
Below is the csv file opened in notpad, it shows the time with increment by one hour, but no display of feedback from the tag. 1 or 0 true or false etc. Thanks!
"t_stamp","RubberScale/Chopper_In_Use"
"2023-09-26 01:36:00.000",
"2023-09-26 02:35:58.125",
"2023-09-26 03:35:56.250",
"2023-09-26 04:35:54.375",
"2023-09-26 05:35:52.500",
"2023-09-26 06:35:50.625",
"2023-09-26 07:35:48.750",
"2023-09-26 08:35:46.875",
"2023-09-26 09:35:45.000",
"2023-09-26 10:35:43.125",
"2023-09-26 11:35:41.250",
"2023-09-26 12:35:39.375",
"2023-09-26 13:35:37.500",
"2023-09-26 14:35:35.625",
"2023-09-26 15:35:33.750",
"2023-09-26 16:35:31.875",
"2023-09-26 17:35:30.000",
"2023-09-26 18:35:28.125",
"2023-09-26 19:35:26.250",
"2023-09-26 20:35:24.375",
"2023-09-26 21:35:22.500",
"2023-09-26 22:35:20.625",
"2023-09-26 23:35:18.750",
"2023-09-27 00:35:16.875",
"2023-09-27 01:35:15.000",
"2023-09-27 02:35:13.125",
"2023-09-27 03:35:11.250",
"2023-09-27 04:35:09.375",
"2023-09-27 05:35:07.500",
"2023-09-27 06:35:05.625",
"2023-09-27 07:35:03.750",
"2023-09-27 08:35:01.875",
You should take the code into the script console, manually build your queryTagHistory call and see what is coming back.
It looks to me like the history query is not returning data.
My bet will be the line where you are building your tag paths is resulting in non valid tag paths for history.