Name

asstring — Provides a type hint to the containing element that it is expecting a string value.

Syntax

asstring(expr)
              

The ASSTRING function has the following arguments:

expr

The child expression that is expected to return a string data type value.

Description

This function provides a type hint to the child expression that a string data type value is expected. If the expression does not provide a string valued result then an error will be raised.

This function is required in situations where the data type of the enclosed expression can not determined by the parser at compile time. This is typically due to an expression that is evaluated at runtime to determine a column from a data table, such as with the column, eval, tablelist, tablemap or tablerange functions. The type hint provided by the ASSTRING function is then used for the semantic analysis required to complete the expression compilation.

No conversion of the data value returned by the child expression is attempted, and if the child data type does not match the hint an error will be generated. For type hinting with data conversion see the string function.

Examples

See the example Table range lookup with a non-literal value in the tablerange function for details about how type hints are used.