Community
Showing results for 
Search instead for 
Do you mean 
Reply

OData query with nesting results in error: criteria[1] is the last criteria but the LogicalOperator is not End.

Highlighted
Copper Contributor
Posts: 205
Country: Netherlands

OData query with nesting results in error: criteria[1] is the last criteria but the LogicalOperator is not End.

I've created an OData Query Builder class for an integration for Act!.

This builder always has the structure of multiple ANDs (with 'and' between them) with one or more OR's in them (with 'or' between them), like:

 

$filter=( (expr1 or expr2) AND (expr3 or expr4) )

 

But i now ran into this problem:

 

the following query fails with a 500 error response with this message:

"Criteria[1] is the last criteria but the LogicalOperator is not End."

 

 

I for instance want to retrieve all cotnacts with:

 

- field A not-empty

- field B not-empty

- field C empty OR field D empty OR field E empty

 

My failing Query:

 

{{apiurl}}/api/contacts?$filter=( businessAddress/line1 ne null ) and ( businessAddress/postalCode ne null ) and ( businessAddress/line1 eq null or businessAddress/city eq null or businessAddress/state eq null or businessAddress/state eq null )

 

If I only place one of the AND's it works, but not the combination. 

 

 

Greetings,

ACT Certified Consultants
TendenZ
the Netherlands