Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

PI DataLink

Write data to PI Data Archive or PI AF

  • Last UpdatedMar 20, 2025
  • 2 minute read

Use the example workbooks distributed with PI DataLink to write data to Data Archive or PI AF with the PIPutVal() and PIPutValX() functions.

If you are writing directly to a PI Point, a connection to the AF Server is not required, regardless of the point type. The PI Point engunits exist in the PI Data Archive (as strings) and are not stored in AF. The behavior is the same for all PI point types. If you are sending values to an AF Attribute, the behavior is the same for all types. AF has a UoM database and does conversions for you, provided you entered valid UoM.

Tip: For an example of how you can write Visual Basic for Applications (VBA) code to use these functions, open the Visual Basic editor for the example workbook and examine the PutVal_code module.

  1. Open the example workbook from the ../PIPC/Excel directory:

    • piexam32.xls, distributed with PI DataLink for 32-bit Excel

    • piexam64.xls, distributed with PI DataLink for 64-bit Excel

    The sample workbooks contain one worksheet, PutVal. This worksheet has two sections. The first section uses the PIPutVal function to enter values for multiple data items, each with a different time stamp.The second section uses the PIPutValX function to enter values for multiple data items with the same time stamp.

  2. In the appropriate cells of the PutVal worksheet, enter the time stamp, data item, and value that you want to write, as well as the root path that specifies the server for the entered data items.

    Worksheet with values entered to write to server

    Worksheet with values

    • 1. Time stamp

    • 2. Data item

    • 3. Value to write

    • 4. Root path

  3. Select the Send above values button to start the macro.

    The macro uses either the PIPutVal() or PIPutValX() function to write the specified values and record the responses, and then uses the PIArcVal function to return the values stored on the server.

    Worksheet after macro runs

    • 1. Response from PIPutVal function

    • 2. Value retrieved with PIArcVal function

TitleResults for “How to create a CRG?”Also Available in