【お知らせ】この部分は英語原文のみでの提供となります。何卒ご了承ください。
2.2.4.5.41 Column::SetAsCategorical
Contents
Description
Set the column as categorical.
Syntax
int SetAsCategorical( int nType, BOOL bUndo = FALSE, BOOL bShowReminder = FALSE )
Parameters
- nType
- [input] categorical map type, can be
- CMT_NONE,
- Remove the categorical settings, won't set the column as categorical
- CMT_NOMINAL,
- Set the column as categorical. It is similar to clear the <auto> check box on the Categories dialog. Work together with CategoricalMap::ReplaceMap to specify a customized categorical map.
- CMT_ORDINAL
- Set the column as Categorial. It is similar to select <auto> check box on the Categories dialog. Work together with CategoricalMap::ArrangeAZ and CategoricalMap::ArrangeZA to sort the categories list as descending or ascending order.
- bUndo
- [input] whether the action should be undoable.
- bShowReminder
- [input] show reminder message box when set as categorical
Return
return TRUE for success, FALSE for failure.
Examples
void Column_SetAsCategorical_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_NOMINAL; //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); wks.Sort(0,SORT_ASCENDING); if ( nRet ) out_str("Column set as categorical."); } }
Remark
See Also
Header to Included
origin.h