Column::IsAsCategorical

 

Description

Return if the column is set as categorical.

Syntax

int IsAsCategorical( )

Parameters

Return

categorical type, CMT_*

Examples

EX1

void Column_IsAsCategorical_ex1()
{
    Dataset ds1;
    Worksheet wks = Project.ActiveLayer();
    ds1.Attach(wks,0); 
    vector<int> vi = {1, 2, 10, 21};
    ds1 = vi;
    
    if ( wks )
    {
        //set the first column in worksheet as categorical
        Column col(wks, 0);
        int nType = CMT_ORDINAL; //set as CMT_ORDINAL, when sort ascending, data like "1, 2, 10, 21" will be sorted as "1, 10, 2, 21";
                                 //if set as CMT_NOMINAL, "1, 2, 10, 21" will be sorted as "1, 2, 10, 21"; if set as CMT_NONE, it won't set the column as categorical
        int nRet = col.SetAsCategorical(nType, FALSE, TRUE);
        //int SetAsCategorical(int nType, BOOL bUndo = FALSE, BOOL bShowReminder = FALSE);
        wks.Sort(0,SORT_ASCENDING);
        if ( nRet )
            out_str("Column set as categorical.");
        
        int nn = col.IsAsCategorical();
        out_int("IsAsCategorical=", nn);
    }
}

Remark

See Also

header to Included

origin.h