4

How to join complex condition with OR in where clause of remote objects like here:

{ 
where: 
    { 
    or: 
        [
        {IsClosed: {eq: false}, Status: {ed: 'Open'}},
        {Status: {ed: 'Open'}}]
    }
}

This doesn't work

4

I'm assuming you want records where:

  • it is not closed and the Status is 'Open'
  • or the Status is 'Open'

Firstly, assuming I've got your logic correct, you don't need the is not closed check in the first part of the clause. (A and B) or B is logically equivalent to just B. This is from boolean algebra. See the second Absorption law.

Still, in terms of syntax for combining and and or, I think you are missing an and. Try:

{ 
where: 
    { 
    or: 
        {
            and:
                {
                IsClosed: {eq: false},
                Status: {ed: 'Open'}
                },
            {Status: {ed: 'Open'}}
        }
    }
}

See also: Format and Options for Remote Objects Query Criteria

3

Someone may find this useful. Here's an example of some success I had with handling a date range:

                {
                    'where': {
                        'and': {
                            'CreatedDate': { 'gte': account_created_from_date },
                            'and': {
                                'CreatedDate': { 'lte': account_created_to_date },
                                'Id': { 'gt': '' }
                            }
                        }
                    }
                }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.