Quantcast
Channel: Microsoft Dynamics 365 Community
Viewing all articles
Browse latest Browse all 17314

Converting enum values to string in Dynamics Ax views

$
0
0

Here is the code snippet for converting enum value to string with the help of my colleague Danish

publicstaticserverstr genderString()

{

tableName viewName = identifierStr(HcmWorkerInfoView_TYL);

DictEnum dictEnum = new DictEnum(enumNum(HcmPersonGender));

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.index2Symbol(n)));

}

return SysComputedColumn::switch( SysComputedColumn::returnField( viewName, identifierStr(PrivateDetais), fieldStr(HcmPersonPrivateDetails, Gender)), enumValues, SysComputedColumn::returnLiteral(dictEnum.index2Symbol(n)));

}



Viewing all articles
Browse latest Browse all 17314

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>