New posts are disabled while we improve the user experience.

You can browse the site, or for urgent issues, raise a query at MyAccount.

question

Upvotes
Accepted
29 2 4 4

Hello, I am working on a legacy application which retrieves data from TREP using Tib Api to parse the data. Whenever i retrieve fid 15 (Currency), I get the currency string, e.g. "GBP". I would like to get the raw value, which in this case, is 826.

When the 'Currency' fid is updated, it it updated with the value of 826. When it is retrieved using Tib api, it is translated to "GBP". How can I get the value of 826?

treprfarfa-api
icon clock
10 |1500

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

Upvotes
Accepted
7.6k 15 6 9
@efreeman

Just want to check if your application called TibMsg::SetEnumExpansion(TRUE); before you get the enum value from tibField.Data(). There could be a reason that TibMsg return string "GBP" rather than number 826.

You can set TibMsg::SetEnumExpansion(FALSE) if you want the number.

Please find more details from TibMsg API Programmer Guide (tmsgapi.pdf) section 12.3.11. TibMsg::SetEnumExpansion, TibMsg::SetInstanceEnumExpansion

icon clock
10 |1500

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

Upvotes
7.6k 15 6 9

@efreeman

For the TibAPI, you mean TibMsg, right?
Can you try method EnumValue2Index like the following sample code?

TibMsg_mfeed *mfeed_ptr; Tib_i32 ind; 
mfeed_ptr = TibMsg::Fname2Mfeed("CURRENCY"); // Point to fid CURRENCY 
ind = TibMsg::EnumValue2Index(mfeed_ptr, "EUR"); // "EUR" -> 978 

You can also use TibMsg::Fid2Mfeed(15) to convert fid id to Mfeed pointer.

icon clock
10 |1500

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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