Skip to content
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

Question: Returning All Values that match Any Condition #22

Open
du8die opened this issue Jun 2, 2018 · 0 comments
Open

Question: Returning All Values that match Any Condition #22

du8die opened this issue Jun 2, 2018 · 0 comments

Comments

@du8die
Copy link

du8die commented Jun 2, 2018

Good Morning,

First, let me start by saying that my use case is certainly non-traditional. So - this question may be beyond the scope of this library - or at the least, I'm trying to stuff a square peg into a round hole.

Background:
I'm currently building a "Logic" column for an adHoc query engine. The idea is this - pull Column 1 and Column 2 out of the database. The logic column will basically say (using the jQuery QueryBuilder tool) if Column 1 = 35 and Column 2 >= 50 then display a message. So, I'm really trying to use the library to determine if a set of data meets the rules.

Data:

Set #1:
//Should return false
[
{ "id":1, "value": 99},
{ "id":2, "value": 98}
]

Set #2:
//Should return true
[
{ "id":1, "value": 99},
{ "id":2, "value": 99}
]

Dynamic Query

{
   'Condition':'AND',
   'Rules':
      [
         {
            'Condition':'AND',
            'Rules':
               [
                  {
                     'Condition':null,
                     'Field':'id',
                     'Id':'id',
                     'Input':'text',
                     'Operator':'equal',
                     'Rules':null,
                     'Type':'string',
                     'Value':'1'
                  },
                  {
                     'Condition':null,
                     'Field':'value',
                     'Id':'value',
                     'Input':'text',
                     'Operator':'equal',
                     'Rules':null,
                     'Type':'integer',
                     'Value':'99'
                  }
               ]
         },
         {
            'Condition':'AND',
            'Rules':
               [
                  {
                       'Condition':null,
                        'Field':'id',
                        'Id':'id',
                        'Input':'text',
                        'Operator':'equal',
                        'Rules':null,
                        'Type':'string',
                        'Value':'2'
                     },
                     {
                        'Condition':null,
                        'Field':'value',
                        'Id':'value',
                        'Input':'text',
                        'Operator':'equal',
                        'Rules':null,
                        'Type':'integer',
                        'Value':'99'
                  }
               ]
         }
      ]
}

I know why this isn't working - but I don't know how to fix it. There are no objects that meet all conditions. I can't use OR because that will return one or the other - not both.

What am I missing? I know in LINQ there is an ANY operator, and that (I think) should work, but it isn't available (as far as I can tell) in ExpressionTrees.

I'm stumped. Any ideas, suggestions, things to try - would be greatly appreciated. The querybuilder is the right tool - and I think this library is probably capable of doing what I need (even with a bit of modification) - but I don't have any clue where to start.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant