mistic100 / jQuery-QueryBuilder

jQuery plugin offering an interface to create complex queries
https://querybuilder.js.org
MIT License
1.69k stars 552 forks source link

Infix to rules #561

Closed preraksola closed 7 years ago

preraksola commented 7 years ago

If I have an expression in the infix notation, is there an existing way using which I can convert it to the rules format for loading the builder. An example of the expression can be: ( ( ( funcA greater 1 ) AND ( ( funcB less 4) OR ( funcX equal 5 ) ) ) )

Or will I need to write a parser for converting the infix expression to the required format?

mistic100 commented 7 years ago

No, if something existed (and I had knowledge of it) it would be listed here http://querybuilder.js.org/plugins.html#other-export

mistic100 commented 7 years ago

But given your example it is just like SQL with different keywords.

I should be relatively easy to start from https://github.com/mistic100/sql-parser to create a new parser, and create a new plugin for QueryBuilder based on "sql-support".

preraksola commented 7 years ago

I'll have a look at it. The example that I posted is a very simple one. The complex one could be something like:
( ( ( funcA( "x" ) greater 1 ) AND ( funcB( "y" ) OR true ) ) THEN logValue( "test" ) )

I am able to generate the above output using the custom ui for the builder. Now I want it to work in a revere way to set the pre-defined rules in the builder.

mistic100 commented 7 years ago

I close this issue as its not the right place to talk about expression parsing. Once you have a working parser I could help you implementing the QueryBuilder plugin if you cannot sort it out from existing code.