2.2.3.19.26 vectorbase::GetUpperBound

Description

Get the upper index of the Dataset display range.

Syntax

int GetUpperBound( )

Parameters

Return

The upper display index of the vector (0 based offset)

Examples

EX1

void vectorbase_GetUpperBound_ex1()
{
    // Call this function with a worksheet active, which contains some data
    // Declare a vector object of size 99
    vector vec(99);
    // Get and report upper bound
    printf("Upper bound/index of vector is: %d\n", vec.GetUpperBound());
    
    // Point to active worksheet
    Worksheet wks = Project.ActiveLayer();
    if( wks )
    {
        // Declare a dataset object that is attached to 1st col of wks
        Dataset dsData(wks, 0);
        if( dsData )
        {
            // Get upper bound/index of dataset and report
            printf("Upper bound/index of dataset/1st col is: %d\n", 
                        dsData.GetUpperBound());            
            // Try changing the "Set as End" property of the worksheet
            // to a different row using the Worksheet menu command,
            // and run this function again.
            // Changing "Set as End" from the GUI is same as 
            // programmatically setting the SetUpperBound property
        }
        else
            out_str("Failed to attach dataset object to 1st col of wks");
    }
    else
        out_str("Active layer is not a worksheet");
}

Remark

Get the upper index of the vectorbase object. Index values returned are 0 based offsets. GetUpperBound is always (GetSize - 1). GetUpperIndex is a synonym for GetUpperBound. GetUpperBound is supported for all vectorbase objects whereas SetUpperBound is supported only for Datasets and not for vectors. Thus the upper bound can be read but not written to, for vectors. This allows for creation of more general purpose functions that can accept vectorbase objects as arguments in place of Dataset objects.

See Also

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

Header to Include

origin.h