Skip to main content

Notifications

Community site session details

Community site session details

Session Id :

Converting enum values to string in Dynamics Ax views

Fawad Hassan Profile Picture Fawad Hassan 337

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

public static server str 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)));

}



This was originally posted here.

Comments

*This post is locked for comments