question

Upvote
Accepted
588 8 13 16

Easy way to translate OMM Enumeration field from number to text?

Trying to convert the enum primitive value to its display value e.g. for CURRECY field want to translate 340 to USD according to enumtype.def. Can I use UPA library to help me solve this problem?
elektronelektron-sdkrrtdataeta-apielektron-transport-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Are you using UPA C or UPA Java?

Upvotes
Accepted
1.2k 23 28 42

In UPA/Java:

DictionaryEntry dictionary_entry;
Enum rssl_enum;
// ... 
LOG.debug("{}", rdm_dictionary.entryEnumType (dictionary_entry, rssl_enum).display().toString());

Similarly in UPA/C:

RsslDictionaryEntry* dictionary_entry;
RsslEnum rssl_enum;
/* ... */
RsslEnumType* enum_type = getFieldEntryEnumType(dictionary_entry, rssl_enum);
printf("%.s", enum_type->display.length, enum_type->display.data);
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
488 12 12 26

UPA is not built to interpret string based content streams – it is intended to interpret and decode binary OMM/RWF content. All of the UPA dictionary helpers are using binary (U16 type) field ID lookups and enumeration lookups.

To use the UPA helpers, you would have to do a lot of string conversion and interpretation to get your content to the point where you could interpret it with UPA – by the time you have done all of the other manipulation, it is probably easier to just write your own enumeration interpreter to avoid multiple conversions to and from strings and better work with the content you are processing.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

This is answering a different question?

Click below to post an Idea Post Idea