This function returns evenly spaced (sampled) events derived by interpolating between Archive events. The time after the first event is passed in times[0] and the time of the last event is passed in times[count-1]. If times[count-1] is 0, the current time is used for the end time.

Interpolated values are used for resolution codes 1, 2, and 3 while the previous value is returned for resolution code 4 points. If there are two events for a single time, the first event in the Archive is returned. For points which are not of type real, rvals is meaningless and the value is returned in istats. The number of values returned is passed in count.

C format

int32 piar_interpvalues(

int32 pt,

int32 PIPTR * count,

int32 times[],

float rvals[],

int32 istats[] );



System error



Bad point number


Bad time stamp


Invalid count parameter


Message too big for PINET protocol


Memory allocation error


pt (passed)

Point number

count (passed, returned)

Number of values

times (passed, returned)

Time stamps of values

rvals (returned)

Values in engineering units

istats (returned)

Integer or status values

Usage Notes

The status "No Data" is returned if the passed time is more than 2 minutes ahead of the PI Server time.

The following example demonstrates how to retrieve evenly spaced Archive events for a point over a specified time period:


#define ARRAYSIZE 2000


int32 status, pt, count;

int32 times[ARRAYSIZE], istats[ARRAYSIZE];

float rvals[ARRAYSIZE];

char tag[13] = "sq:f100";

/* get the point number */

if ( status = pipt_findpoint( tag, &pt ) )

ERRORRETURN( "findpoint", status ); 


/* get beginning and ending time stamps */

if ( status = pitm_parsetime   ( "Y-8h", 0, &(times[0]) ))

ERRORRETURN( "pitm_parsetime", status ); 

if ( status = pitm_parsetime( "+24h", times[0],    &(times[ARRAYSIZE-1]) );

ERRORRETURN( "pitm_parsetime", status ); 


/* get archive data */

count = ARRAYSIZE;

status = piar_interpvalues( pt, &count,   times,rvals,istats);

/* ...check status */

/* ...if count == ARRAYSIZE we may need to get more data */

Enabling Operational Intelligence