Hello,
I am using Ignition Perspective and I have built a page which allows you to:
1- select a tag from "TagBrowseTree'
2- select the start time
3- select the end time
4- click export button
The export button has the following OnClick Event:
def runAction(self, event):
# Assuming you have a Tag Browser component named 'TagBrowser' and start/end time input components
# Get selected tags from the Tag Browser
selectedTags = self.getSibling("TagBrowseTree").props.selection.values
# Get start and end times from input components (replace 'startTime' and 'endTime' with your actual component names)
startTime = self.getSibling("startTime").props.value
endTime = self.getSibling("endTime").props.value
# Query historical data for selected tags within the specified time range
historicalData = system.tag.queryTagHistory(paths=selectedTags, startDate=startTime, endDate=endTime)
csv = system.dataset.toCSV(historicalData)
# Use system.file.saveFile to have the user find a directory to write to.
filePath = system.perspective.download("TrendExport.csv", csv, "Comma Separated Values")
I have noticed that when I click on the export button and the tag selected is of type float, the csv table duplicates the last value with the timestamp I clicked on the export button. Refer to images below.
I do not have this issue with non-float values such as datetime or string. How can I make sure that float values do get the duplicate? I just want what is stored in the database to be exported.
Notice the timestamp is 2:42:58 AM
When I clicked the export button at 2:44:05 AM, this is what I got in my csv file but the timestamp of the tag did not really change: