The Expression template appears in the template list when a datetime field has been picked in the Select pane. The template selects records using SQL expressions.
Expression |
Select using the given expression.
Launch the template by choosing a datetime field in the Select pane and then double-clicking the Expression template. When the template launches we can specify options.
Example: Select Dates in Leap YearsWith a simple expression we can use the DateTimeYearLeap function to select dates that are leap years.
We start with a table with a single field of type datetime, called Random date. We have used the Layers pane to hide the mfd_id field, for a simpler illustration.
With the focus on the table window, in the Select pane we choose the Random date field. We double-click on the Expression template to launch the template.
In the Expression template, we press the Edit Expression button. In the Expression dialog that opens we enter the expression
DateTimeYearLeap([Random date])
and then we press OK.
Back in the Select pane, for the Action, we use the default replace selection option.
Our example expression uses the DateTimeYearLeap function. The function returns TRUE if the year part of a datetime value is a leap year.
Press Select.
The template selects records where the date value in the Random date field is a leap year. If we would like to select records with dates that are not leap years, we simply enter Ctrl-I to invert the selection, or we choose Edit - Select Inverse.
|