Skip to content

How to combine multiple OR conditions #3049

Discussion options

You must be logged in to vote

Hi. I suggest converting your query to SQL first. I'm assuming this the filter you're looking for:

WHERE 
  (StartDate => $SearchDate AND EndDate IS NULL) 
  OR (EndDate <= $SearchDate AND StatusCode IS NULL)
  OR (StatusCode IS IN ($SearchStatus))

The or operator will apply an OR to all the elements inside, e.g. this:

?or=(val1.is.null,val2.is,null)

translates to

WHERE (val1 IS NULL OR val2 IS NULL)

So, to simplify your query, it could be expressed like this:

?or=(condition1,condition2,condition3)

Since these conditions have an AND between them, then you'll have to use the and() operator inside (I added spacing it so you can see it better):

?or=(
  and(startDate=gte.$searchDate,endDat…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
5 replies
@arnaud-thorel-of
Comment options

@laurenceisla
Comment options

@arnaud-thorel-of
Comment options

@laurenceisla
Comment options

@arnaud-thorel-of
Comment options

Answer selected by wolfgangwalther
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants