Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

Is it possible to export the query to a format suitable for https://github.com/CacheControl/json-rules-engine? IDK if that makes a ton of sense but we are using json-rules-engine in our backend already and are looking at viable/advanced rule builders for our frontend.

Obviously the developer would have to make sure that the necessary facts are loaded into the rule engine.

That would be amazing.

You must be logged in to vote

Not yet, but definitely soon! I'm working on a "rules engine" extension to RQB (see below) that will manage a structure similar to json-rules-engine. It will be based more on RQB's existing RuleGroupType, but the translation should be fairly straightforward. The new extension will have a formatQuery equivalent (probably formatRulesEngine) providing an option to export as json-rules-engine condition/event objects.

Replies: 1 comment · 5 replies

Comment options

Not yet, but definitely soon! I'm working on a "rules engine" extension to RQB (see below) that will manage a structure similar to json-rules-engine. It will be based more on RQB's existing RuleGroupType, but the translation should be fairly straightforward. The new extension will have a formatQuery equivalent (probably formatRulesEngine) providing an option to export as json-rules-engine condition/event objects.

You must be logged in to vote
5 replies
@flodaniel
Comment options

Amazing! Is that like a couple weeks or more a couple months kinda project?

@jakeboone02
Comment options

I expect to have something usable within a couple of weeks, although it may not be fully baked. Thanks for pointing me to json-rules-engine, by the way. I hadn't seen that before and it's very helpful!

@flodaniel
Comment options

No problem!
What i don't fully understand: Why is all of that work needed? Can't the current query builder be used to express rules of any kind already?

@jakeboone02
Comment options

Not really. RQB manages queries—analogous to the WHERE clause in SQL. What it calls "rules" are really just filters or conditions—like the part in parentheses of an if block (aka the antecedent).

There's currently no mechanism for handling a logical cascade like a rules engine, which is more like a full-blown if/else-if/else sequence of antecedents. There's also currently no accommodation for the "then" part—the resulting action or data when a condition is met (aka the consequent). That's what the extension package will add: the antecedent/consequent cascade.

@flodaniel
Comment options

Ok thanks a lot. We are now looking more into our options. Looks like we don't really need that more complicated rule building - a query builder is enough. However exporting/importing to json-rules-engine is what we need but we only found this "middleware" package we could use: https://github.com/alexberriman/json-rules-engine-to-json-logic

Answer selected by flodaniel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.