react-awesome-query-builder icon indicating copy to clipboard operation
react-awesome-query-builder copied to clipboard

How to assign output to expression result?

Open Yosbnwpq opened this issue 3 years ago • 3 comments

Not a bug but a question.

I see how to build expressions using the editor, but how do I use the output of the expressions to assign return values?

For instance, take the following expression constructed from the query builder:

(vendor == ' Toyota' && year >= '2010')

How do I then use the query builder to express usage of the resulting output? As an example, how would I construct the following logic to set a variable "price"?

if (vendor == ' Toyota' && year >= '2010') then price = '20000' else price = '10000'

Yosbnwpq avatar Feb 07 '22 04:02 Yosbnwpq

What format of output do you want to use for evaluating expressions? I assume you want to evaluate with JS, so probably SpEL or JsonLogic?

ukrbublik avatar Feb 08 '22 12:02 ukrbublik

I'm more asking for the SELECT portion of the query. The query builder lets me define the WHERE portion of the query, but I'm not sure how to make use of it after I define it.

Yosbnwpq avatar Feb 08 '22 21:02 Yosbnwpq

Building SELECT part of SQL is not supported, and I'm not sure about when I can implement this as it's not in priority

ukrbublik avatar Feb 09 '22 08:02 ukrbublik