Expressions are displayed in a query as a column, just like any other field, however they are not linked to a single data source field. TitlesIn a Query, the Title is generally optional, but for expressions, there must be a Title. This is to allow the expression to be selected in the Views and Embeds that are based on the Query. If you blank out the Title it will be reinstated as Expr or Expr[n] where [n] is a unique integer. Union QueriesIf you construct a Union Query, ie a Query with more than one Source Group, then in a given column you can create a separate expression for each Source Group. In this scenario the Output Type of each expression in that column must match. Queries with only expressionsIf your query only consists of expressions, and does not contain any data sources, the query will return one recordset per Source Group. Literal valuesTo enter a literal value: For numbers, simply enter the digits For text, enter the text surrounded by quote marks. You can use either single ' or double " quotes (which is useful as you can then contain the alternate quote mark within the literal text) TroubleshootingIf there is an error in an expression it will return a blank (null) value. Common reasons for errors are: - badly formed expressions
- missing or inappropriate operators (for example, using + instead of || for string concatenation)
- incompatible field datatypes
When checking why an expression is not giving the results you expected, start by checking the datatypes of any fields that are included. They may not be what you expect, or they may have been changed since the expression was created. Then look at the values of the fields in the tables: It may be that the expression is correct, but it is working with values that differ from what you expected. If you want to display a different (ie not blank) value when the expression is null, you can use the Coalesce function to return an alternative value. See the Function Reference for details. |