SQL expression for content filter in XML

2 posts / 0 new
Last post
Offline
Last seen: 10 months 4 weeks ago
Joined: 11/23/2021
Posts: 32
SQL expression for content filter in XML

Hi @all,

I want to create a content filter as an SQL expression in my XML description for a data reader.
The filter should filter samples against a "device_id". Inside the Python API implementation the filter looks like the following:

my_device_id = "Actuator1234"
#create a filter
filter = dds.Filter("device_id MATCH %0", [my_device_id])
filter.name = dds.Filter.stringmatch_filter_name
content_filtered_topic = dds.DynamicData.ContentFilteredTopic(brake_command_topic, "ContentFilteredTopic", filter)

How can I realize this filter as an SQL expression using Python Connector in my XML description?

<data_reader name="BrakeCommandReader" topic_ref="Brake Command" >
    <datareader_qos>
        <deadline>
            <period>
            </period>
       </deadline>
    </datareader_qos>
    <filter name="Brake Command" kind="builtin.sql">
        <expression> .... </expression>
    </filter>
</data_reader>

Thanks in advance!

Regards,

Marc

 

Offline
Last seen: 10 months 4 weeks ago
Joined: 11/23/2021
Posts: 32

I resolved this problem by adding the following expression:

<expression> device_id MATCH 'my_device_id' </expression