question

Upvotes
Accepted
29 2 1 2

Sending updates to Refinitiv via MLIP, I was able to update all fids with text strings. Will I be able to do the same using EMA C++ and posting to TRCC?

I am replacing an application which sends data to Refinitiv via a MLIP with a EMA C++ application which uses posting to TRCC. Sending updates via MLIP, I was able to update all fids with text strings. Will I be able to do the same using EMA C++ and posting to TRCC?

If not, is there a function to retrieve the 'RWF Type' from the data dictionary by 'Fid', so I can format the data correctly in the payload.

Thanks.

elektronrefinitiv-realtimeelektron-sdkrrtema-apielektron-message-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.

10 Answers

Upvotes
Accepted
7.6k 15 6 9

@efreeman

I just found other functions from the DataDictionary class and you can use it to get the DictioanryEntry directly by passing fid_id or fid name to the function.

There are functions

DataDictionary::getEntry(thomsonreuters::ema::access::Int16  fieldId)
DataDictionary::getEntry(const thomsonreuters::ema::access::EmaString & fieldName)


You can find more details about the functions under DataDictionary class from refman page provided under folder <EMA Install Folder>/Cpp-C/Ema/Docs/refman/ema/index.html

Below is the details of the functions from refman page.

so from my sample codes

DataDictionary dataDictionary; dataDictionary.loadFieldDictionary( "RDMFieldDictionary" ); dataDictionary.loadEnumTypeDictionary( "enumtype.def" ); 

Then you can call below function to get the type directly but please note that it will throw OmmInvalildUsageException if the fid id does not exist.

dataDictionary.getEntry(fid_id).getRwfType();

You can wrap the function into your own method to handle the exception or call it directly depending on your requirement.



dictentry.jpg (107.0 KiB)
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.

Upvote
11.5k 16 7 10

Hello @efreeman

Please see the following resource regarding how to contribute data to TRCC with Elektron SDK

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
7.6k 15 6 9

@efreeman

As far as I understand MLIP uses legacy SSL protocol which transfers data as a text string so you can update all fids with text. But for TRCC it uses RWF binary format, therefore, you have to update the fids using the type defined in the dict.

To get the RWF Type for specific fid you can use DataDictionary class to load data dictionary like the example IProvider example 332__Dictionary__UserControl or 350__Dictionary__Streaming.

You may load the Dict from a local file using

DataDictionary dataDictionary; dataDictionary.loadFieldDictionary( "RDMFieldDictionary" ); dataDictionary.loadEnumTypeDictionary( "enumtype.def" ); 

And then get dictionary entries using

const auto& dictEntries = dataDictionary.getEntries();

Then you can call

dictEntries[fid_id].getRwfType(); 

which will return RWFType enum value defined in DataType.h and it will throw OmmOutOfRangeException if the fid_id is not available in dictEntries.


For example,

Enum value 8 is RealEnum.

You may create a utility function like below sample codes to get the type.

int AppClient::get_fid_rwf_type(const EmaVector<DictionaryEntry>& dict_entries, const int fid_id)
{
    unsigned int index = 0;
    while (index < dict_entries.size() && dict_entries[index].getFid() != fid_id) index++;
    if (index >= dict_entries.size())
        return -1;
    else
        return dict_entries[index].getRwfType();
}
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
29 2 1 2

Hi Moragodkrit,

That is exactly what I was looking for. Excellent explanation. I will test as soon as I can.

Thanks.

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
29 2 1 2

Hi Moragodkrit,

I am able to use your examples above to retrieve the Rwf Type. It seems to work but, I am receiving many discrepancies.

Fid

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
29 2 1 2

Hi Moragodkrit,

I am testing the above to retrieve Rwf Type, but I am receiving many discrepancies. Here are some examples :

fid RDMFieldDict dict_entries[fid].getRwfType()

3 RMTES_STRING 14

79 DATE 8

339 RMTES_STRING 8

996 REAL64 14

1003 RMTES_STRING 8

I need to get correct Rwf Type to post FID data using correct data types.

Thanks.


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
7.6k 15 6 9

@efreeman

Sorry, my understanding of the DictionaryEntries indexer is not correct. It does not support direct access to the dictionary entry using the indexer. It looks like we need to iterate through the EmaVecter, which holds the DictionaryEntry to check if the entry contains the fid id and then return the rwf type.


I have updated the codes and test them again, and below is my test result, new codes returns the correct rwf type. Can you test it again and let me know the result?


Fid#3 RMTES_STRING  DataType:19
Fid#79 DATE DataType:9
Fid#339 RMTES_STRING  DataType:19
Fid#996 Real64 DataType:8
Fid#1003 RMTES_STRING  DataType:19
Fid#32766 MAP  DataType:137
Fid#-2 Unknown DataType:-1


Anyway, based on the way we use to retrieve the type, it's not a good idea to call the method to check the type every time we publish the data, so you might need to cache the type in your data structure, and you can re-use it later.

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
29 2 1 2

Hi Moragodkrit,

dataDictionary.getEntry(fid_id).getRwfType()

worked perfectly.

Do I have to worry about performance? Is it using a map or index into a table?

Thanks.

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
7.6k 15 6 9

@efreeman

Based on the ESDK source file from GitHub https://github.com/Refinitiv/Elektron-SDK/

It looks like the EMA internal implementation keeping the raw data for dictionary entry in the array, and it indexed by FieldId. Therefore the getEntry method should be able to access dictionary entry directly when passing fid id to the function.

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
29 2 1 2

Hi Moragodkrit,

Thanks for looking into that. This is exactly what I need.

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.

Click below to post an Idea Post Idea