Skip to main content

Posts

Showing posts with the label return literal

How to get Enum value in String for Query base view in Axapta

To get Enum value in String for Query base view in Axapta 2012 you can try below code sample for your method. Here example will return label enum value you can use for name also. public static server str ItemType() { tableName viewName = identifierStr(ViewName); DictEnum dictEnum = new DictEnum(enumNum(ItemType)); Map enumValues = new Map(Types::String, Types::String); int n; for (n = 0; n < dictEnum.values(); n++) { enumValues.insert(int2str(dictEnum.index2Value(n)),SysComputedColumn::returnLiteral(dictEnum.index2Label(n))); } return SysComputedColumn::switch( SysComputedColumn::returnField(viewName, identifierStr(InventTable_1), fieldStr(InventTable, ItemType)), enumValues, SysComputedColumn::returnLiteral(dictEnum.index2Symbol(n))); }