11 Replies Latest reply on Sep 11, 2018 2:45 PM by Oscar_Garcia

    Easy to use script to extract time-series tag data into CSV

    Meir

      This tool is deprecated - find a new tool here - ProcessBook Multiple Tags Long Period Data Extractor Tool

       

       

      Hi all

       

      Sometimes it is useful to be able to extract large portions of historical tag data into CSV files (i.e. for analyzing it by 3'rd party software). Straight forward data access method like Excel DataLink is limited in the amount of data it can handle.

       

      Script Download

       

      I improved the previously posted method (limited to space-less tag names) and I am posting it here, as it might be useful for other people. I do plan to continue improving it even more, so I'll try to keep this thread updated.

       

      The archive contains 2 batch files:

      • TagsList.bat - will create tags.list file containing all tags available in PI System
      • TagsExtract.bat - will create CSV file within 'out' directory for each tag containing timestamp and value. By default it will extract last 200 days of data, if you need another period, change "total_days" variable within TagsExtract.bat file

       

      How to use

      1. Run TagsList.bat
      2. Remove unneeded tags from tags.list
      3. Set 'total_days' variable in TagsExtract.bat
      4. Run TagsExtract.bat

      (These scripts might be useful to be run at night, when large amounts of data are needed to be extracted.)

       

      Limitations:

      • The script cannot handle ArcMaxCollect setting (limiting the transaction size) for now, I am planning to find out a solution for it in future.

       

      (Under the hood, those script are using piconfig.exe utility in read-only manner - "@mode list").

       

      Github sources

       

      Enjoy!

       

      --

      Meir Tseitlin

       

      Message was edited by: Meir Tseitlin