Filtering doesn't treat char as numeric value

3 posts / 0 new
Last post
Offline
Last seen: 7 years 2 months ago
Joined: 06/04/2015
Posts: 6
Filtering doesn't treat char as numeric value

When setting up a query condition, the comparision operation fails when trying to compare a numeric value with a char.

For example, in the IDL, if there is a opic defined as:

struct EntityType 
{
    char m_domain;

}

the query condition will fail if using a query condition such as "m_domain = 1"

but if the IDL is changed so that m_domain is of type "short", then the query condition comparision works properly.

I also tried "m_domain = '1'" whichdidn't work.

Is there any way to compare an 8bit value as a numeric value?

 

Gerardo Pardo's picture
Offline
Last seen: 19 hours 45 min ago
Joined: 06/02/2010
Posts: 601

Hello David,

What version of RTI Connext DDS are you using?

I verified that the expression   "m_domain = '1' "  does work in Connext DDS 5.1. However the '1' is being interpreted as the character '1', which maps to a numeric value of 49 (per ascii standard).  If you want the numeric value 1 as an 8 bit value, then you could use the type "octet" in your IDL as in:

struct EntityType 
{
    octet m_domain;
} 

Then the expression: "m_domain =  1" should work.

-Gerardo

Offline
Last seen: 7 years 2 months ago
Joined: 06/04/2015
Posts: 6

Using octet works as expected. Thanks for your help