Add this function to the global class so that you will be able to call it anywhere in code in your Axapta application:
static int UniqueEnumCombo(int Enum1, int Enum2)
{
return str2int(int2str(Enum1) + int2str(Enum2));
}
All this function does is to convert two integers to there respective string values then concatenate them and convert the result back to an integer. Remember that the internal representation of enum is integer. Note also that the order of the parameters is relevant. For example, 1 and 2 is different from 2 and 1 which will work for your case.
You can test this function in a job with the following code:
static void UniqueEnumComboTest(Args _args)
{
;
switch (UniqueEnumCombo(1, 2))
{
case UniqueEnumCombo(3, 4):
info(strfmt('%1',UniqueEnumCombo(3, 4)));
break;
case UniqueEnumCombo(1, 2):
info(strfmt('%1',UniqueEnumCombo(1, 2)));
break;
}
}
Varden Morris
J. Wray & Nephew Ltd. - Group I.S.
Phone: (876) - 923 - 6141 Ext. 2226
Fax: (876) - 923 - 5372
Cell: (876) - 3833566
Email: [EMAIL PROTECTED]
daniellim_yh <[EMAIL PROTECTED]> wrote:
hi all,
i have 2 enum type, 4 elements each, i wonder wat is the best way
for me to do
like this in axapta.
if (enum1::typeA && enum2::typeW)
Do something1
else
if (enum1::typeA && enum2::typeX)
Do something 2
else
if (enum1::typeA && enum2::typeY)
do something 3
.
.
.
.
if (enum1::typeD && enum2::Z)
do something 16
with 2 combinations of 2 enums i will have 16 combinations, any
better
way of it?using enum element position to do looping may be?but as
i know i cannot get enum position like container.
pls provide any idea. thx in advance.
rgds,
daniel
Sharing the knowledge on Axapta.
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
Sharing the knowledge on Axapta.
Yahoo! Groups Sponsor | |
|
|
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/Axapta-Knowledge-Village/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.