2.2.4.46.56 Worksheet::MakeGroupEntriesAndRowMap

Description

Provides categorical information for the worksheet

Syntax

BOOL MakeGroupEntriesAndRowMap( int r1, int r2, matrix<ushort> & mEntries, vector<ushort> & vRowMap, const vector<ushort> & vCols )

Parameters

r1
[input] Begining row number to be considered in the worksheet
r2
[input] Ending row number to be considered in the worksheet (r2 = -1 to consider the whole worksheet from r1 on).
mEntries
[output] A matrix with the number of columns equal to the size of vCols; each column corresponds to one column in vCols.
The number of rows of the matrix is equal to m_0*m_1*m_2*...*m_(n-1),
where n is the size of vCols, while m_i is the size of the categorical map
for the column vCols[i]. The values on each column of the matrix are all possible combinations of
indices 0, 1, ...,m_i - 1, in a nested way, the first column changes the slowest, etc.
vRowMap
[output] A vector of the size r2 - r1 (+ 1 if r2 is included), which maps every row of worksheet
in the range r1->r2 to rows of the matrix considered as bins
(so that the first row in the vector, corresponding to r1 row in the worksheet,
maps to the first row of the matrix, etc.).
vCols
[input] An array of column indices in the worksheet (if the array is empty, do nothing and return FALSE).

Return

Returns TRUE on successful exit and FALSE on error.

Examples

EX1

//this example assumes that the worksheet if exsits have at least 5 columns
void    Worksheet_MakeGroupEntriesAndRowMap_Ex1()
{
    Worksheet wks = Project.ActiveLayer();
    if(!wks)
        return;
    
    int r1 = 0;
    int r2 = -1;
    Column cc(wks, 0);
    vector<ushort> vRowMap(cc);// assume group col already contain group numeric values like 1,2,3 etc
    matrix<ushort> mEntries;
    vector<ushort> vCols = {0, 2, 4};
    wks.MakeGroupEntriesAndRowMap( r1, r2, mEntries, vRowMap, vCols );
}

Remark

See Also

Worksheet::ExtractOneGroup

Header to Include

origin.h