Skip to Content
0
Former Member
Mar 23, 2009 at 10:24 AM

MDM API to get lookup field value

78 Views

I have retrieved the record I am looking for from my main table using the MDM API - One of the fields of the main table is a flat lookup field. If I use getLookupDisplayValue(), it returns something like "TU, Turkey". The actual lookup table consists of fields "code" and "name". I only want to fetch the "code" value - Not a comma separated value which includes the name value.

So my main table name is "plant_extensions", and the lookup table name is "enterprises".

I have tried to use the following code:

...
Record rcArray[] = plant_record.findLookupRecords(field_id);

This returns only one value which is correct. I then want to get the value in the "code" field of the lookup table, so I do the following:

rcArray[0].getLookupDisplayValue(getFieldId("lookup_table_name", "code");

For some reason, it won't accept this field ID - It says that it has not been maintained, or does not exist.

Am I doing this the correct way, or is there a better way to do this?