Discover Refinitiv
MyRefinitiv Refinitiv Perspectives Careers
Created with Sketch.
All APIs Questions & Answers  Register |  Login
Ask a question
  • Questions
  • Tags
  • Badges
  • Unanswered
Search:
  • Home /
  • Elektron /
  • EMA /
avatar image
Question by marian · Oct 02, 2018 at 06:24 AM · ema c++omminvalidusageexception

Exception Type='OmmInvalidUsageException' when using fixedWidth in view Array

Most likely something primitive, but I wanted to check our understanding:

when creating a view I thought it was a good practice to set the array size as fixed. It looks as if this is triggering an Exception OmmInvalidUsageException.

Please see below is an example of a simple snapshot request using a view array. Is this normal?

AppClient client; OmmConsumer consumer(OmmConsumerConfig().username("user")); 

//Symbols
OmmArray symbolArray;
{
  symbolArray.addAscii("EUR=");
  symbolArray.complete();
}
//Fields
std::vector<thomsonreuters::ema::access::Int64> fields{11,12,13,22,25};
OmmArray viewArray;
//viewArray.fixedWidth(static_cast<thomsonreuters::ema::access::UInt16>(fields.size())); //With this line we are getting 
//"Exception Type='OmmInvalidUsageException', Text='Unsupported fixedWidth encoding in addInt(). Fixed width='5'. '""
//If commented out everything seems to work fine. Is it normal?
for (auto f : fields)
{
  viewArray.addInt(f);
}
viewArray.complete();
ElementList elemList;
elemList.addArray(thomsonreuters::ema::rdm::ENAME_BATCH_ITEM_LIST, symbolArray);
elemList.addUInt(thomsonreuters::ema::rdm::ENAME_VIEW_TYPE, 1);
elemList.addArray(thomsonreuters::ema::rdm::ENAME_VIEW_DATA, viewArray);
elemList.complete();
ReqMsg test;
//Just a snapshot
consumer.registerClient(ReqMsg().serviceName("hEDD").interestAfterRefresh(false).payload(elemList), client);

People who like this

0 Show 0
Comment
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

1 Reply

  • Sort: 
avatar image
REFINITIV
Best Answer
Answer by warat.boonyanit · Oct 02, 2018 at 06:30 AM

Hi @marian

fixedWidth() is not for the size of the array but for the length of each content inside.

By using fixedWidth(X) you basically define that content inside the array cannot be bigger than X bytes.

fixedWidth() is used for decoding optimization and can be omitted.

Edit: "each content"

Comment

People who like this

0 Show 4 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

avatar image
marian · Oct 02, 2018 at 10:09 AM 0
Share

Thank you @Warat B. The only thing I do not understand is how it is working when I am setting fixedWidth(2) and requesting only fieldID 22,25, which are clearly bigger in total than 2 bytes. Do you have any idea?

avatar image
REFINITIV
warat.boonyanit ♦♦ marian · Oct 03, 2018 at 12:55 AM 0
Share

Hi @marian

My apologies, It is the length of each content inside the array, not the entire content. I just misread the guide.

By using fixedWidth(2) you basically define that each content inside the array, in this case, the signed int, cannot be bigger than 2 byte, which is –32,768 to 32,767.

avatar image
marian warat.boonyanit ♦♦ · Oct 03, 2018 at 10:14 AM 0
Share

Thank you @Warat B. and apologies for following up on this, I just want to fully understand it.

In EMA/Src/Access/Include/DataType.h for Data::RealEnum which is used for price I read:

RealEnum = 8,/*!< An 8-byte precision (19-20 decimal places) fixed-placed representation
of a numeric with either a fractional or exponential part. The range of
a fractional part is 1/2 through 1/256. The range of an exponential
part is 10-14 through 10+7. */ 

When creating a view with only best bid(fid=22) and best ask (fid=25) each element size is 8 bytes. So, why is it working with fixedWidth(2)?

Watch this question

Add to watch list
Add to your watch list to receive emailed updates for this question. Too many emails? Change your settings >
6 People are following this question.

Related Questions

[EMA C++] Exception Type='OmmInvalidUsageException', Text='Closed / Suspect / User unknown to permissioning system, it could be DACS , AAA or EED

convert EMA C++ sample code into a Windows Service

I have an EMA C++ consumer appilcation which does offstream posting. I want to run multiple instances using the same machine account/password. Is this allowed?

how can I deserialize RefreshMsg and UpdateMsg ?

access violation when reading from a container

  • Feedback
  • Copyright
  • Cookie Policy
  • Privacy Statement
  • Terms of Use
  • Careers
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Alpha
  • App Studio
  • Block Chain
  • Bot Platform
  • Calais
  • Connected Risk APIs
  • DSS
  • Data Fusion
  • Data Model Discovery
  • Datastream
  • Eikon COM
  • Eikon Data APIs
  • Elektron
    • EMA
    • ETA
    • WebSocket API
  • Legal One
  • Messenger Bot
  • Messenger Side by Side
  • ONESOURCE
    • Indirect Tax
  • Open PermID
    • Entity Search
  • Org ID
  • PAM
    • PAM - Logging
  • ProView
  • ProView Internal
  • Product Insight
  • Project Tracking
  • Refinitiv Data Platform
    • Refinitiv Data Platform Libraries
  • Rose's Space
  • Screening
    • Qual-ID API
    • Screening Deployed
    • Screening Online
    • World-Check One
    • World-Check One Zero Footprint
  • Side by Side Integration API
  • TR Knowledge Graph
  • TREP APIs
    • CAT
    • DACS Station
    • Open DACS
    • RFA
    • UPA
  • TREP Infrastructure
  • TRIT
  • TRKD
  • TRTH
  • Thomson One Smart
  • Transactions
    • REDI API
  • Velocity Analytics
  • Wealth Management Web Services
  • World-Check Data File
  • Explore
  • Tags
  • Questions
  • Badges