Tech Tip: Write a query condition as a literal string expression for a date or time attribute
PRODUCT: 4D | VERSION: 19 | PLATFORM: Mac & Win
Published On: July 11, 2022
In the most case, a query string expression on a date or time attribute can be written using a value placeholder. For example:
$entSel:=ds.TableName.query("dateField = :1";!2022-07-12!) $entSel:=ds.TableName.query("timeField = :1";?01:00:00?) |
$entSel:=ds.TableName.query("dateField = :1";$dateVar) $entSel:=ds.TableName.query("timeField = :1";$timeVar) |
If there is a need for the query string to be written (or injected) as a literal string expression, it must be in the following form.
$entSel:=ds.TableName.query("dateField = 2022-07-12") $entSel:=ds.TableName.query("timeField = 01:00:00") |
The prefix and suffix (! and ?) for each type are unnecessary in this literal query expression.