0

I'd like to expand the search functionality so that users can enter in some text and have that matched against multiple fields eg name and email

How do I specify that in the "where" string?

if (!is_null($output['search']['value'])) {
   $where .= '&&' . 'Name.ToLower().Contains("' . strtolower($output['search']['value']) . '")';
}
Sarah K
  • 363
  • 2
  • 15

1 Answers1

2

You can just use the word OR - e.g.

?where=Name.Contains("contactname")+OR+(EmailAddress+!=+null+AND+EmailAddress.Contains("contactemail"))

As per the docs though, complex where clauses are bad for performance. I'd strongly recommend making separate requests for each property where possible.

rustyskates
  • 856
  • 4
  • 10
  • Thanks @rustyskates Twigged when looking through the invoices that maybe I was passing raw code rather than parameters that were going to be manipulated. The paging is pretty primitive too so I might change my approach. – Sarah K Mar 17 '20 at 09:31