Apply content filter with various number of parameters

5 posts / 0 new
Last post
Offline
Last seen: 10 years 6 months ago
Joined: 06/22/2014
Posts: 2
Apply content filter with various number of parameters

Hi,

I have a little question about content filtered topic.

Here is my scenario:

Lets say I have 4 units in my system: A, B, C and D.

Units A, B and C publishing messages to unit D.

Each message has an int field named ID.

A (ID=1), B(ID=2) and C(ID=3).

I am looking for a way to create a content filtered topic and pass it to D's reader in the following way:

D should receive messages from A and C only.

I have created the following content filter expression " (ID=1) AND (ID=3) and it worked.

The problem is that now I want to be able to change the filtered units many times without restarting D's reader.

Is there any way to to create something like this:

ContentFilterExpression: "(ID=%0)" and provide an array of ints for parameter %0? (using something similar to STRINGMATCH and append_to_expression_parameter function)?

 

Thank you

Organization:
Keywords:
Offline
Last seen: 3 years 9 months ago
Joined: 01/15/2013
Posts: 94

Hi Vitalik,

The filter expression is applied to each sample arriving to the Data Reader in D. For the expression you were successful, did you mean "ID=1 OR ID=3"?

I don't think we have a construct in our SQL language subset to build arrays or parameters. In any case, if you have a limited set of IDs in your data, you could aways add the following expression: "ID=%0 OR ID=%1 OR ID=%2", and then build the expression parameters list with all the ID values you want checked, and for the exceeding parameters, just repeat some of the ID values. For example, if you want to change the subset of valid IDs to {2, 3} then you could use "ID=2 OR ID=3 OR ID=3". The resulting expression is logically equivalent to "ID=2 OR ID=3". If, as another example, you only wanted to get ID 1, then you could do: "ID=1 OR ID=1 OR ID=1". This is equivalent to "ID=1".

This is a just workaround for the limitation you spotted. Let me know if something like this would work for you.

Additionally, please recall that you can also use expressions of type "ID BETWEEN %0 AND %1" to specify ranges, although that wouldn't cover the case of, for example, "ID=1 OR ID=3".

Thanks,

Juanlu

Offline
Last seen: 10 years 6 months ago
Joined: 06/22/2014
Posts: 2

Hi Juan,

Thank you for reply and a suggested workaround. It worked for me.

Do you have any plans to add an implementation for the mentioned limitation in the next versions?

Thank you

Offline
Last seen: 3 years 9 months ago
Joined: 01/15/2013
Posts: 94

Hi Vitalik,

Glad I could help. I don't know about any plans for implementing this, I believe it isn't in the pipeline at this moment.

Thanks,

Juanlu

Offline
Last seen: 6 months 2 weeks ago
Joined: 06/12/2024
Posts: 2

Thank you for reply and a suggested workaround. It worked for me.

_________________________

blog erotyczny