enum2String(<Enum>) Returns the string value of the enum so enum2String(noYes::No) returns ‘No’

I use the these two methods for getting element names and values form an enum value or index.

static str enumValueString(str _Enum, anyType _enumValue)
{
   DictEnum dictEnum;
   ;
   dictEnum = new DictEnum(xutilelements::getNode(
       xutilelements::find(utilelementtype::Enum,_Enum)).applObjectId());

return dictEnum.index2Name(_enumValue);
}


static str enumName(str _Enum, anyType _enumValue)
{
   DictEnum dictEnum;
   ;
   dictEnum = new DictEnum(xutilelements::getNode(
       xutilelements::find(utilelementtype::Enum,_Enum)).applObjectId());

   return dictEnum.index2Symbol(_enumValue);
}

examples enum2String((valueCriteria::Max) returns Maximum
enumName('valueCriteria', valueCriteria::Max) returns Max enumName('valueCriteria', 1) returns Max
enumValue('valueCriteria', valueCriteria::Max) returns Maximum
enumValueString('valueCriteria', 1) returns Maximum


Hope they help

-Preston





-----Original Message-----
From: prabodh_kelkar [mailto:[EMAIL PROTECTED] Sent: Thursday, September 18, 2003 8:20 AM
To: [EMAIL PROTECTED]
Subject: [development-axapta] Re: How to access enum values in loop



Hi Harry,


Thanks for giving me time and trying out things for me ....
You tried to insert value in a enum field ABC. But I was trying the reverse way.....
I wanted to insert enum value to string field and not reverse way.....
At last what i did is, i put all values to container, then used conpeek function in loop to get values from the container & then inserted that value by converting to string.....
Do u have any way to insert enum value to string field ???


Thanks,
Prabodh Kelkar




--- In [EMAIL PROTECTED], Harry <[EMAIL PROTECTED]> wrote:
hi Prabodh!

Confused.

I tried on my machine. Tried to insert value in a enum field ABC.
When i = 0
at the time of inserting the table browser shows the value of
ABC::None,
when i was 1 table browser shows the value of ABC::A and so on.

Are u trying something different?

regards

harry deshpande

-----Original Message-----
From: prabodh_kelkar [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 16 September 2003 8:46 p.m.
To: [EMAIL PROTECTED]
Subject: [development-axapta] Re: How to access enum values in loop



Hi,

I tried following code
>int i = 0;
>
>  while (i<= enumcnt(nameofenum))
>  {
>        ABCTable.columnname = i;
>        ABCTable.insert();
>        i++
>  }
But if u assign "i" to ABCTable.columnname, then, in the table the
value of "i" at that particular time is saved, and not the value of
element at i'th position in the enum.
Can we do that???

Thanks,
Prabodh




--- In [EMAIL PROTECTED], Harry <[EMAIL PROTECTED]>
wrote:
> hi Prabodh!
>
> int i = 0;
>
> while (i<= enumcnt(nameofenum))
> {
> ABCTable.columnname = i;
> ABCTable.insert();
> i++
> }
>
> will work.
>
> all enum values are stored as integers and the text is displayed
when
> browsing the table.
>
> regards
>
> harry
>
> -----Original Message-----
> From: prabodh_kelkar [mailto:[EMAIL PROTECTED]
> Sent: Monday, 15 September 2003 10:43 p.m.
> To: [EMAIL PROTECTED]
> Subject: [development-axapta] Re: How to access enum values in
loop
>
>
> Hi All,
>
> Thanks for reply.......
> But It didn't solve my problem. It seems that I am not able to ask
> question in proper way......
>
> I am writing a job to populate data in table....
> In the job I want to insert the values from enum in the column.
> there are 10 values in enum and I want to insert those 10 values
as
> different rows....so I am using a loop.
> In that loop I want to assign .....
>
> ABCTable.ColumnName = Enumvalue of enum at element equal to
Counter ;
>
> then I use --> ABCTable.insert();
>
> but, in loop i am not able to get value of the element at position
> equal to counter, in the enum.
> How should I do that?
>
> Thanks,
> Prabodh Kelkar
>
>
>
> --- In [EMAIL PROTECTED],
<[EMAIL PROTECTED]>
> wrote:
> > Hi,
> > try this.
> > int counter;
> > SysDictEnum SysDictEnum;;
> > SysDictEnum = new SysDictEnum(EnumNum(ABC));
> > for (counter = 0;
> > counter <= enumcnt(ABC)-1;
> > counter++)
> > {
> > info(SysDictEnum.index2Label(counter));
> > }
> >
> > Mit freundlichen Grüßen / Best regards / Med venlig Hilsen
> > Jesper J¢rgensen
> >
> > Original Message processed by Tobit InfoCenter
> > Subject: [development-axapta] Re: How to access enum values in
loop
> (15-Sep-2003 11:32)
> > From: [EMAIL PROTECTED]
> > To: [EMAIL PROTECTED]
> >
> >
> > Hi,
> > Thanks for quick reply....
> > But this is not my problem.
> > say that there is enum "TestEnum1" with 4 elements "A","B","C"
> > and "D". I want to print "A","B","C" and "D".......
> > I want to do this using a for loop with counter i...
> > How to get the element of enum "TestEnum1" at position i,
> > programmatically and print it........
> > Thanks,
> > Prabodh Kelkar
> >
> >
> >
> > --- In [EMAIL PROTECTED], Harry <[EMAIL PROTECTED]>
> wrote:
> > > hi
> > >
> > > int i = 0;
> > >
> > > while (i<= enumcnt(nameofenum))
> > > {
> > > i is the value of enum, do something with i.
> > > i++
> > > }
> > >
> > > will work as long as the useenumvalues property of the enum is
> set
> > to true
> > >
> > > regards
> > >
> > > harry deshpande
> > >
> > > -----Original Message-----
> > > From: prabodh_kelkar [mailto:[EMAIL PROTECTED]
> > > Sent: Monday, 15 September 2003 9:08 p.m.
> > > To: [EMAIL PROTECTED]
> > > Subject: [development-axapta] How to access enum values in
loop
> > >
> > >
> > > Hi,
> > > I want to use the values of enum in loop.
> > > I want to use the counter of the loop to navigate through the
> > > elements/values of an enum. i.e. I want to get next value of
enum
> > as
> > > loop navigates......How to do that?
> > > Help will be highly appreciated........
> > > Thanks,
> > > Prabodh Kelkar
> > >
> > >
> > >
> > >
> > >
> > >
> > > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/
> >
> >
> > Yahoo! Groups Sponsor
> > ADVERTISEMENT
> >
> >
> >
> >
> > Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.
>
>
>
>
>
> Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/





Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/




Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


Yahoo! Groups Sponsor ADVERTISEMENT
click here


Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

Reply via email to