08-30-2018 02:38 PM
Is it possible to only read instances of a topic where the key is not equal to something?
Here are some simplified details to help explain my question. I'm opening a dataReader and dataWriter for the Topic: "Channels". The "Channels" topic contains two keys: "ChannelName", and "Origin" (both of which are strings). The "Origin" field is used to denote which target originally generated the data. Each target will be responsible for publishing it's own data. Since I'm already keeping each target's own channels in shared memory on the target, I want to ignore the instances of the "Channels" topic that originate from the same target. So in essence, I would like to create a content filter or query condition that will only return instances of "Channels" that were generated from another system. Something like "Origin" != "Target_A".
All documentation I have found on content filters and query conditions seems to indicate that the only valid operations are:
'='
|'>'
|'>='
|'<'
|'<='
|'<>'
|'LIKE'
|'MATCH'
Let me know if there is a way to create this filter, or feel free to recommend a different solution to this problem if I'm going about it inefficiently.
Thanks.
Solved! Go to Solution.
08-30-2018 03:33 PM
Ok, for some reason, I completely overlooked the '<>' comparison in the list. The following query condition works as intended:
(Origin <> 'Target_A')
I guess I would still like to know if there is a better way to go about this. Is this going to be the highest performance? Or does anyone have a better way of doing this?
08-31-2018 04:04 AM
Hi zcollins,
As you know the condition before creating your entity, and this doesn't change during run-time, I recommend you to use ContentFilteredTopic instead of QueryCondition. ContentFilteredTopic is faster and allows write-side filtering.
About other options, you may want to have a look at partitions, and multichannel. You can configure these parameters through QoS. Here I put a link to some examples (they are not in LabVIEW, but you only need the USER_QOS_PROFILES.xml)
Partition example: https://community.rti.com/examples/partitions
Multichannel example: https://community.rti.com/examples/multichannel
There are no tests on the performance of these options.
Angel.