1

To query specific objects in our system we can use filters. Currently we are working on filter manager in which you can enter your conditions in text mode to query objects in the system. We can write there our own custom filter, in the form of RSQL queries ( https://github.com/jirutka/rsql-parser ) and our own query language. The backend logic of the filter manager itself is written in Java, and JS is used for the front-end.

As a rule, the expression queries written in the Filter Manager work fine, the problem starts with the "IN condition". For example, we have such a condition:

Users IN ("value1,value2", "value3", "value4")

Unfortunately, "value1,value2" will not be treated as one attribute, but broken into two:

Users IN (""value1", "value2"", "value3", "value4")

As a result, the condition becomes invalid, because two quotation marks appear next to each other and a single value is broken into two values.

The problem is that some objects and attributes have a comma in our name, and as far as I can see with the "IN operator" you cannot use commas if there is a comma in the attribute name. I would like to give up the idea, where for such purposes you cannot use IN operator, only OR operator - because OR operator works fine.

I am wondering what approach can be used (besides bagaround using the OR operator). I was wondering about the Jiro approach, where in filters you can write values with and without quotes. For example:

User IN ("value1,value2", value3, value4)

And then "value1,value2" is treated as one attribute. I also thought about some clever escape characters, or maybe some regexp, but I am not sure.

Does anyone have any suggestions on how to approach this problem or any possible solutions? I'm quite lost. Thanks in advance for any answers and comments!

MagicMan
  • 73
  • 5

0 Answers0