Attach a CategoricalData object to an internal Origin data set.
Attach a CategoricalData object to an internal Origin data set by worksheet name and column number.
BOOL Attach( LPCSTR lpcszDatasetName, UINT wType = CMT_ORDINAL )
BOOL Attach( LPCSTR lpcszWksName, UINT wColumnNumber, UINT wType = CMT_ORDINAL )
BOOL Attach( Column& col, UINT wType = CMT_ORDINAL )
True if success else false
True if success else false
True if success else false
EX1
void CategoricalData_Attach_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_Attach_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 strWksname = wks.GetPage().GetName(); StringArray vMyCatMap; CategoricalData cdMyCatData; cdMyCatData.Attach(strWksname,0,CMT_ORDINAL); vMyCatMap = (StringArray) cdMyCatData.Map; // Requires explicit cast } }
Attach a CategoricalData object to an internal Origin data set by worksheet name and column number.
CategoricalData::CategoricalData
origin.h