KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: How to perform case-sensitive string query
PRODUCT: 4D | VERSION: 19 | PLATFORM: Mac & Win
Published On: May 24, 2022

By default, string queries usually ignore letter casing. For example, a query for “Smith” could return “Smith”, “smith”, and “SMITH”. To perform a case-sensitive string query, use Match regex in a query formula. For instance, given a “People” table and “name” field with these records:

The following code returns an entity selection of the only entity with the exact name “Smith”:

$formula:=Formula(Match regex("^Smith$"; This.name))
$result:=ds.People.query($formula)