Hello, I am working on a legacy application which retrieves data from TREP using Tib Api to parse...

efreeman
efreeman Explorer

... 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?

Tagged:

Best Answer

  • @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

Answers

  • @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.