Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Info

Download the

Solution Example here:

solution HistorianToCSV.dbsln

Software Version: 10.1

Built with v10.

This solution example shows how to Export Historical data to a CSV file.



Summary

This solution example shows how to Export Historical data to a CSV file.

Image RemovedImage Added


Technical Information

This project solution uses the TrendChart for visualizing to visualize tag values that change over time when while the solution is running. Each Pen pen (Tag tag value) has is displayed in a different color in on the graph, which you can configure as you like, including a legend whose position you can modify. All the graph information will be saved in customize, along with the legend position. All graph data is saved to a file with the default extension as of .csv.
In TWebBrowser, it is possible to view the content of the file, and in the settings, you can configure the URL of the exported file. Through this URL, the WebBrowser can access the path of the file and display its content.

Additionally, the file will be saved in the same path as your solution, but you can change that by going to Displays / MainPage / CodeBehind, and modifying the lines of code as in the example below:

Code Block
@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);


Note that, in this code example, 'ret' stores the return of the SaveToTextFile method, indicating success (true) or failure (false).


References Information

→ Learn more at at Historian (Time-Series Data).


In this section:

Page Tree
root@parent
spacesV10