Cicode Programming Reference > Cicode Function Categories > Statistical Process Control Functions Introduction > SPCGetSubgroupTable

SPCGetSubgroupTable

Returns an array containing the specified subgroup's elements with the mean, range and standard deviation. The data will be in the following order:

Element0, Element1, ... , Element(n-1), Mean, Range, StdDev

where n is the subgroup size.

This function can only be called while the SPC tag is being displayed on an SPC page.

Syntax

SPCGetSubgroupTable(sSPCTag, iSubgroup, TableVariable)

sSPCTag:

The SPC Tag name as defined in SPC Tags.

iSubgroup:

The number of the subgroup being displayed whose data is to be retrieved. Zero ('0') represents the latest subgroup.

TableVariable:

The first element of the Cicode array that will store the sample data. This variable needs to be defined as a global array of type REAL. The number of elements in the array needs to be equal to (or greater than) the subgroup size + 3.

Return Value

0 (zero) if successful, otherwise an error number is returned. The subgroup's data is written to TableVariable.

Related Functions

TableMath

Example

/* This function will get the minimum value present in the sample
data of a particular SPC tag.*/
REAL rSubgroup[8]; ! 5 samples + mean + range + stddev.
! This variable needs to be global to the file, so is declared outside of the function
REAL
FUNCTION
GetMinSample(STRING sTAG)
INT iError;
REAL iMin = 0;
iError = SPCGetSubgroupTable(sTag, 7, rSubgroup);
!The elements of rSubgroup now hold the group samples, mean, range and stddev.
IF iError = 0 THEN
! Get minimum. Be aware that the range of data is 5
iMin = TableMath(rSubgroup,5,0,0);
END
Return iMin;
END

See Also

SPC Functions