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

PI DataLink

PIPutVal() and PIPutValX()

  • Last UpdatedNov 21, 2022
  • 2 minute read

Writes a value to the Data Archive server or PI AF server and returns a string that indicates the status.

  • Only use the PIPutVal and PIPutValX functions within Visual Basic for Applications (VBA). Do not enter these functions in the Excel formula bar. See Functions to write data.

  • In the current version of PI DataLink, there is no difference between the PIPutVal function and the PIPutValX function. In PI DataLink versions earlier than PI DataLink 2013, the PIPutVal function only supported three traditional PI point types: real, integer, and digital. In those versions of PI DataLink, the PIPutValX function added support for string points and subsecond time stamps.

Syntax

PIPutVal(DataItem, Value, TimeStamp, RootPath, OutCell)

PIPutValX(DataItem, Value, TimeStamp, RootPath, OutCell)

Arguments

Argument

Type

Description

DataItem

String

The name of the PI point or PI AF attribute to which the function writes a value.

Value

Reference

A reference to the cell that contains the value to be written, either a string or a number.

TimeStamp

String

The time stamp for the value. See Time inputs.

RootPath

String

The path to the data item. See Data items.

OutCell

Reference

A reference to the cell where PI DataLink writes the string that macro function returns. The returned string varies:

  • If the write succeeds:

    • The PIPutVal function returns xxx Written where xxx is either Real Value, Integer, Digital State, or Value, depending on the value type written.

    • The PIPutValX function returns Value Written.

  • If the write fails, the function returns an error code such as [-5] Tag not found.

Notes

The PIPutVal and PIPutValX functions cannot write to PI AF attributes that are configuration attributes. These functions can only write to a PI AF attribute for which the Configuration Item check box is not selected. You can check the status of the check box on the Attributes tab in PI System Explorer.

The PIPutVal and PIPutValX functions support all Data Archive data types. The functions interpret time stamps using client-machine time-zone information for Data Archive unless the PI Data Archive time zone setting is enabled.

The functions do not verify the user-specified range for a point before writing the value. The range is defined as zero to zero + span, where zero and span are point attributes specified during point creation. The function returns a Value Written string even if Over Range or Under Range is stored in Data Archive.

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in