DataRange::GetNamesOfDatasets

Description

Gets the names of all the datasets that appear in the DataRange.

Syntax

int GetNamesOfDatasets( vector<string> & vsNames, BOOL bAvoidRepetitions = FALSE )

Parameters

vsNames
[output]receives all the name
bAvoidRepetitions
[input,optional]if TRUE, the repetitions will be eliminated.

Return

The total number returned, or a negative value for error.

Examples

//Get the four datasets's name in the datarange.
void DataRange_GetNumDatasets_Ex1()
{
        //assume the active worksheet has least four columns before run this code.
        Worksheet wks = Project.ActiveLayer();
        if ( !wks )
        {
                printf("Can not find any active worksheet!");
                return;
        }

        DataRange dr;
        dr.Create();//init the object
        dr.Add("X", wks, 0, 0, -1, 0);//Four datasets.
        dr.Add("Y", wks, 0, 1, -1, 1);
        dr.Add("Y", wks, 0, 2, -1, 2);
        dr.Add("Y", wks, 0, 3, -1, 3);
        
        vector<string> vsNames;
        dr.GetNamesOfDatasets(vsNames, true);
        return;
}

Remark

See Also

header to Include

origin.h