ihuRetrieveSampledDataEx2

Use the ihuRetrieveSampledDataEx2 function to return sampled data based on the raw samples stored in the archive with filters and query modifiers by using pszFilterExpression and CriteriaString. Interpolated, Trend, and Lab are example SamplingMode values. Use this function with hybrid sampling modes such as TrendToRaw or InterpolatedToRaw to return the sampling mode that was actually used.

Prototype

ihuRetrieveSampledDataEx2 {
long serverhandle, // [in] which server to fetch from
IHU_TIMESTAMP StartTime, //[in] Start time for the query
IHU_TIMESTAMP EndTime, //[in] End time for the query
ihuSamplingMode SamplingMode, //Sampling Modes
MSO_Char *pszFilterExpression, // [in] Filter Expression e.g. Tag > 20
IHU_FILTER_MODE FilterMode,   // [in] Filter Modes
MSO_Char *CriteriaString, // [in] QueryModifiers to use with data reads
unsigned long NumberOfSamples, //[in] 0 or number of samples to return
IHU_DATA_INTERVAL Interval, // [in] 0 or sampling interval in units provided by IntervalType
IHU_RETRIEVED_DATA_RECORDS_EX *DataRecords //[in/out] - you fill in tagnames of the structures and API will fil
};

Remarks

To request data, you can specify a number of samples or a time interval. Set one parameter to a non-zero value and the other to 0. To split the duration, divide the time from start to finish into evenly spaced time intervals.

To skip filtering, you can pass NULL to pszFilterExpression and ihuExactTime to FilterMode, or you can use ihuRetrieveSampledData().

Pass NULL to CriteriaString if you do not use a QueryModifier.

Returns

The ihuRetrieveSampledDataEx2 function returns ihuSTATUS_OK when values are successfully retrieved, and returns errors on:

  • Read timeouts
  • User is not a member of the ih Readers security group
  • Tag not found
  • Filter criteria or query modifiers cannot be set