-
-
Notifications
You must be signed in to change notification settings - Fork 504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Group conditions exported incorrectly (except MongoDB) #246
Comments
At the moment the JsonLogic string produced is not the expected one. As reported into the issue the expected string should be:
Instead the produced string is:
As you can see the object {"var": "results"} is enclosed in an unexpected array. |
Are you sure removing square brackets will produce correct results when using "some" operation? |
The square brackets shown in docs are around the data. If you scroll just a little bit down, you will find this example
The example in JsonLogic docs should be similar to the one in your demo for the results object, where:
Here there aren't square brackets around {"var":"pies"}. |
In your example This example works only with
|
i understood your example, but in this case you have to put square brackets around results, in the JsonLogic rule, because results it's not an array, and you have to transform it. In JsonLogic all/some/none are operators to work with arrays, I think is not right to apply them to an object instead of an array. With JsonLogic a rule like that is enough to achieve the same behavior of your example:
The external AND at the moment is pleonastic but it could be useful if you have to add other conditions
|
I can make using 'some' for nested fields optional, configurable. PR is welcomed ;) |
Hi there! I am currently using If you look at the documentation of jsonLogic, it says "These operations take an array, and perform a test on each member of that array." Expected BehaviorLet's look at what is being taken in for the two examples: Example 1
Here, the first operand is an array. This evaluates to Example 2Logic:
Data:
Here,
which is a variant of Example 1. This also evaluates to Generalized,
Actual Behavior
which will result in the equivalent expression:
Here, |
@Angelus1383 @dtsun-anduril I finally understood the root cause of issue and misunderstanding. I'm preparing PR to fix this. |
Hi there, is there any option to config export for !group type for sql format ? |
@mariojaros Did you found any way to export json fields in SQL? |
Please create a separate issue for SQL |
|
Describe the bug
The exported logic of group conditions differs depending on the export format. Looks like only MongoDB export works right.
To Reproduce
go to https://ukrbublik.github.io/react-awesome-query-builder/
and try this:
MongoDB export produces code that checks product and score fields simultaneously for each element of results array :
But jsonLogic checks them independently:
Expected behavior
jsonLogic export should look like that:
The text was updated successfully, but these errors were encountered: