2.2.4.9.19 DataRange::GetNumRanges

Description

Get the numer of subranges in this DataRange.

Syntax

int GetNumRanges( )const

Parameters

Return

numer of subranges in this datarange

Examples

EX1

//This example output the min and max values of each subrange.
void DataRange_GetNumRanges_Ex1()
{
	//Create a worksheet, add a column and fill with data.
	Worksheet wks;
	wks.Create("Origin");
	wks.AddCol();
	wks.SetColDesignations("XYZ");
    for ( int ii = 0; ii < 20; ii++ )
    {
        wks.SetCell(ii, 0, ii);
        wks.SetCell(ii, 1, ii+1);
        wks.SetCell(ii, 2, ii*2);
    }
	
	DataRange dr;
	dr.Add(wks, 0, "X");//Create a "XYZ" datarange.
	dr.Add(wks, 1, "Y");
	dr.Add(wks, 2, "Z");
	
	int nNumRanges = dr.GetNumRanges();//number of subranges in the datarange.
	vector vData;
	double dmin, dmax;
	
	//Get the min and max of each subrange.
	for( int nIndex = 0; nIndex < nNumRanges; nIndex++ )
	{
		dr.GetData(&vData, nIndex);
		vData.GetMinMax(dmin, dmax);
		printf("min = %g\nmax = %g\n", dmin, dmax);
		vData.RemoveAll();
	}
	
}

Remark

See Also

DataRange::GetNumData

Header to Include

origin.h