Tech Tip: Take advantage of the IN operator in ORDA queries
PRODUCT: 4D | VERSION: 17 | PLATFORM: Mac & Win
Published On: October 2, 2019
When making ORDA queries, it's common to simply create a query string which compares one value is equal to another value. Let's say we want to query all clients that are residing in the west coast.
However, this type of query can become very long. Another way to query is to compare whether one value is included in a set a values or a collection using the IN operator which can shorten the query string and makes it much easier to read.
C_OBJECT($es) $es:=ds.Client.query("state = AL | state = AZ | state = CA | state = CO | state = MT | state = WA") |
However, this type of query can become very long. Another way to query is to compare whether one value is included in a set a values or a collection using the IN operator which can shorten the query string and makes it much easier to read.
C_OBJECT($es) C_COLLECTION($states) $states:=New collection("AL";"AZ";"CA";"CO";"MT";"WA") $es:=ds.Client.query("state IN :1";$states) |