Download the Solution Example here: HistorianToCSV.dbsln
Solution Name: HistorianToCSV
Software Version: 10.1
Summary
This solution example shows how to Export Historical data to a CSV file.
Technical Information
This solution uses the TrendChart for visualizing tags values that are changing over time when the solution is running. Each Pen (Tag value) has a different color in the graph that you can configure as you want, such as a legend that you can modify its position. All the graph information will be saved in a file with default extension as csv.
In TWebBrowser, it is possible to view the content of the file and in settings you can configure the Url of the file exported, through this url the WebBrowser can access the path of the file and show its content in display. Besides, the file will be saved in the same path as your solution, but you can change that, going to Displays → MainPage → CodeBehind , and change the lines of code as in the example below:
@Tag.SelectedFileName = ""; @Tag.SelectedFileName = @"Path" + @Tag.OutputFilename; bool ret = @Historian.Table.Table2.SaveToTextFile(@Tag.StartDateTime.LocalDateTime, @Tag.EndDateTime.LocalDateTime, @Tag.SelectedFileName, ',', true, true, true, 6, null);
References Information
→ Learn more at Historian (Time-Series Data).
In this section: