Enum comparison

Ihave an Enum ItemItype with following values

0 - Item (in en-us) and Article in (fr)

i am using en-us version of Axapta

now,

i have an excel sheet from which am reading values for ItemType

the excel is in french. so the value of ItemType is “Article”

i want to compare this value with enum

am using following code

str s1 = “Article”; // = “Item”;

if(str2enum(ItemType::Item,s1) == itemType::Item)

{

info(“Equal”);

}

it works only when am in french version of axapta , since value of s1 = “Article” (fr)

how can i make this comparison language independent

Any hep is Most appreciated :slight_smile:

Thanks & Regards,

Harshini

Hi Harshini,

I’m not sure of getting list of all languages. But you can try below code, it may help in your case.

static void Enum2Label(Args _args)

{

DictEnum dictEnum;

int valueIndex;

LanguageId languageId=‘fr’;

int enumId=enumNum(ItemType);

str labelId;

;

dictEnum = new DictEnum(enumId);

if (dictEnum)

{

for (valueIndex = 0 ; valueIndex < dictEnum.values(); valueIndex++)

{

labelId = dictEnum.index2LabelId(valueIndex);

info(SysLabel::labelId2String2(labelId, languageId));

}

}

}

Ambanna Yatnal