amitsdotcom
18th December 2013, 17:00
I request some help on confirming if we have any function to retrieve the "Constant Name" from an Enum domain.

In other words like how we get the Enum constants description through enum.descr$ do we have any function where we can actually get the constant name and not the constant value or description itself...

One way I can think of is to put if condition and store values in variable for a fixed number of enum set data, but just wanted confirm if we have any other way of doing this or some function...

mark_h
18th December 2013, 19:51
Not sure about LN but on 4c4 I use rdi.domain.enum.value - the keyword below returns the name. Sometimes I use the descript to hold file locations. So my domain could be tisfc.files, with the enum of tfdir with description like /app/file/. So my full domain would be tisfc.files.fdir and the description is /app/files/. So fdir is returned in the keyword() parameter and /app/files/ is returned in descr() parameter.


rdi.domain.enum.value( string domain_name, long enum_item, string language, ref string keyword(.), ref string descr(.), ref long value )

Description

This returns information about a specified item in an enumerated domain.

Arguments

domain_name The name of the domain.
enum_item The numeric code of the enum item for which you want to retrieve information.
language The language code for the enumerated domain.
keyword This returns the name of the specified enum item.
descr This returns the description of the specified enum item.
value This returns the value of the specified enum item.

amitsdotcom
19th December 2013, 09:46
Thanks Mark, I have tested this function in ERP LN FP5 and it works for my requirement, though when testing I found the result of this function not so consistent, not sure if we can call this a bug or not.

See attached document which confirms it works for a couple of instances and does not for others...

I am thinking to ask with Infor Support team why the function does not return consistent result for this scenario...

andreas.toepper
19th December 2013, 10:29
Theres a problem within this function. It will not return the value of the enum 10, but of the 10th enum in the domains enum list.

Please take a look into the programmers guide (there's a codeexample at the end):

------------------------------------
rdi.domain.enum.value()
Syntax:
function long rdi.domain.enum.value (string domain_name, long enum_item, string language, ref string keyword(.), ref string descr(.), long value)

Description

This returns information about a specified item in an enumerated domain.


Arguments
string domain_name The name of the domain.

long enum_item The position of the enum item for which you want to retrieve information.

string language The language code for the enumerated domain.

ref string keyword(.) This returns the constant name of the specified enum item.

ref string descr(.) This returns the description of the specified enum item.

long value This returns the constant value of the specified enum item.


Return values
0 success

-1 error

Context
This function is implemented in the porting set and can be used in all script types.

Example
long cnt
long ret
long i

string keyword(15)
string descr(40) mb
long val

ret = rdi.domain.enum("ttyeno", cnt)
for i = 1 to cnt
rdi.domain.enum.value("ttyeno", i, "2", keyword, descr, val)
|...
|...
endfor
------------------------------------

There are some more functions, but i still havn't used them:

rdi.ctoe$
rdi.etoc$

But I think rdi.etoc$ may be of help.