Output codes
- Last UpdatedMar 20, 2025
- 2 minute read
- PI System
- PI DataLink 2023 SP1
- Visualization
PI DataLink function syntax contains an integer OutCode argument. This argument takes an output code that determines which Appended data the function returns and the orientation of output cells.
PI DataLink task panes generate output code values automatically. However, if you enter a function manually in the Excel formula bar, you need to calculate and include an appropriate output code value.
An output code is an integer representation of binary bits. In PI DataLink, bit meaning depends on the function:
Bit meaning for Current Value and Archive Value functions
|
Bit |
Purpose |
|---|---|
|
1st |
Show time stamp in column to left of value |
|
2nd |
Show time stamp in row above value |
Bit meaning for other PI DataLink functions
|
Bit |
Purpose |
|---|---|
|
1st |
Show time stamps |
|
2nd |
Orient data in rows rather than columns |
|
3rd |
Show percent good |
|
4th |
Hide count |
|
5th |
Show extended status |
|
6th |
Show annotations |
|
7th1 |
Show start time |
|
8th1 |
Show end time |
|
9th1 |
Show min/max time |
|
1 Requires that the 1st bit be enabled also |
|
With the OutCode argument set to 0, a function returns the value in a column orientation with no appended data. To compute the OutCode argument, use the following formula:

For example, with an OutCode argument of 0, the PISampDat() function returns the sampled values in the designated output cell. With an OutCode argument of 1, the function returns time stamps in column one and sampled values in column two of an n x 2 array. With an OutCode argument of 3, the function returns time stamps in row one and the sampled values in row two of a 2 x n array. (In these results, n is the number of sampled values.)
Note: Functions support different bits and therefore OutCode argument values. Those valid for one function are not necessarily valid for another function. See the Function reference for the bits that each function supports in its OutCode specification.
Example
Suppose you want the Calculated Data function to display percent good, start time, and min/max time. To display the start time and min/max time, you must enable the show-time-stamps bit. To calculate the OutCode argument:

In the Excel formula bar, enter:
=PIAdvCalcDat("sinusoid","y","t","1h","minimum","time-weighted", 50, 1, 325,"MyDataServer")
Note: If an OutCode argument specifies the display of multiple columns or rows but the worksheet does not show them, right-click the function array and choose Recalculate/Resize to rewrite the function array.