Dataset::SetUpperBound

Contents

Description

Set the upper display index of the Dataset.

Syntax

BOOL SetUpperBound( int nUpper )

Parameters

nUpper
[input] New upper display index of the Dataset

Return

Returns TRUE on successful exit and FALSE on failure.

Examples

EX1

void Dataset_SetUpperBound_ex1()
{
    // a Worksheet with at least 1 column must exist prior to execution
    Worksheet wks=Project.ActiveLayer();
    if (wks)
    {      
        Dataset    dsA(wks, 0);
        dsA.SetSize(10);
        for(int ii = 0; ii < 10; ii++)
            dsA[ii] = ii;
        
        dsA.SetLowerBound(2);
        dsA.SetUpperBound(7);
        BasicStats bsStatVal;
        Data_sum(&dsA, &bsStatVal);
        ASSERT( bsStatVal.min == 2 );
        ASSERT( bsStatVal.max == 7 );

        dsA.SetLowerBound(0);
        dsA.SetUpperBound(9);
        Data_sum(&dsA, &bsStatVal);
        ASSERT( bsStatVal.min == 0 );
        ASSERT( bsStatVal.max == 9 );
    }
}

Remark

Set the upper display index of the Dataset range. Index values are 0 based offsets so use SetUpperBound(-1) to display no rows. SetUpperBound is supported only for Datasets (not vectors) while GetUpperBound is supported for all vectorbase derived objects. This allows for creation of more general purpose functions that can take vectorbase objects as arguments in place of Dataset objects. Essentially, the upper bound can be read but not written for vectors. SetUpperIndex is a synonym for SetUpperBound.

See Also

vectorbase::GetUpperBound, vectorbase::GetSize, vectorbase::SetSize, vectorbase::GetLowerBound, Dataset::SetLowerBound

header to Include

origin.h