2.2.3.1.2 CategoricalData::CategoricalData

Description

Default constructor to create a CategoricalData object.


Constructor to create a CategoricalData object by data set name.


Constructor to create a CategoricalData object by worksheet name and column number.

Syntax

CategoricalData( )


CategoricalData( LPCSTR lpcszDatasetName, UINT wType = CMT_ORDINAL )


CategoricalData( LPCSTR lpcszWksName, UINT wColumnNumber, UINT wType = CMT_ORDINAL )


CategoricalData( Column& col, UINT wType = CMT_ORDINAL )

Parameters

lpcszDatasetName
[input] Input name of internal Origin data set
wType
[input] Input type of CategoricalMap (only default CMT_ORDINAL is supported)


lpcszWksName
[Input] name of internal Origin worksheet
wColumnNumber
[Input] column number in worksheet
col
[Input] column object
wType
[Input] type of CategoricalMap (only CMT_ORDINAL is supported)

Return

Examples

EX1

void CategoricalData_CategoricalData_ex1()
{
    Worksheet wks;
    wks.Create();
    if (wks)
    { 
        Dataset ds(wks, 0);
        ds.SetSize(8);
        vector<string> vs = {"aaa","bbb","ddd","ccc"};
        ds.PutStringArray(vs);
        string strWksColname = wks.Columns(0).GetName();
        strWksColname = wks.GetPage().GetName() + "_" + strWksColname;
        
        StringArray vMyCatMap;
        CategoricalData cdMyCatData;
        cdMyCatData.Attach(strWksColname,CMT_ORDINAL);
        vMyCatMap = (StringArray) cdMyCatData.Map; // Requires explicit cast
    }
}


EX2

void CategoricalData_CategoricalData_ex2()
{
    Worksheet wks;
    wks.Create();
    if (wks)
    { 
        Dataset ds(wks, 0);
        ds.SetSize(8);
        vector<string> vs = {"aaa","bbb","ddd","ccc"};
        ds.PutStringArray(vs);

        string strWksColname = wks.Columns(0).GetName();
        strWksColname = wks.GetPage().GetName() + "_" + strWksColname;
        
        StringArray vMyCatMap;
        CategoricalData cdMyCatData(strWksColname);
        vMyCatMap = (StringArray) cdMyCatData.Map; // Requires explicit cast
    }
}


EX3

void CategoricalData_CategoricalData_ex3()
{
    Worksheet wks;
    wks.Create();
    if (wks)
    { 
        Dataset ds(wks, 0);
        ds.SetSize(8);
        vector<string> vs = {"aaa","bbb","ddd","ccc"};
        ds.PutStringArray(vs);

        string strWksname = wks.GetPage().GetName();
        
        StringArray vMyCatMap;
        CategoricalData cdMyCatData(strWksname,0,CMT_ORDINAL);
        vMyCatMap = (StringArray) cdMyCatData.Map; // Requires explicit cast
    }
}

Remark

Constructor to create a CategoricalData object and attach it to an internal Origin data set by worksheet name and column number.

See Also

CategoricalData::Attach

Header to Include

origin.h