Or operations

Typically a query by example consists of AND operations. 


Using constraints just gives us the opportunity for more complicated AND operations


Sometimes you want to to OR operations – for example people under 10 or over 25. Not all underlying databases even have an OR capability (for example DataStore), but database abstraction provides a consistent way to do OR operations across all supported back ends.

How to do ORS

The following syntax applies to all backends
Lets say you want to do these 2 queries and combine the results


Just make an array of queries


You can mix in constraints as well if you want


Duplicates are automatically removed (if records qualify for more than one query they are returned only once)

See Database abstraction with google apps script for more on this.

[do_widget id=jetpack_widget_social_icons-7] [do_widget id=text-5]