The getDataSourceAlias, getThisDataSourceAlias and getMainDataSourceAlias Placeholders

Previous Next

See Also

The getDataSourceAlias placeholder is used to refer to the (USoft-generated) alias of a data source in a SQL statement:

${getDataSourceAlias(<DataSource name>)}

The getThisDataSourceAlias placeholder is used to refer to the (USoft-generated) alias of the data source itself in a SQL statement:

${getThisDataSourceAlias()}

This placeholder can be used in SELECT and WHERE clauses, especially in WHERE clauses of embedded data sources, to refer to fields that exist in both the embedded data source, and its enclosing data source. It is not possible to use the getThisDataSourceAlias placeholder in ExecuteSQLStatement actions.

The getMainDataSourceAlias placeholder is used exclusively in WHERE clauses, and refers to the (USoft-generated) alias of the main data source in the FROM clause.

${getMainDataSourceAlias()}

For example, for a PERSON table with a relationship to itself, the Where Clause property can be set to:

EXISTS(

       SELECT * FROM PERSON

       RELATE Person "IS FATHER OF" ${getMainDataSourceAlias()}

       WHERE family_name LIKE 'R%'

       )

The Page Engine translates this statement to:

SELECT  ID, FAMILY_NAME, FIRST_NAME, 'Yes' UseIOFormats

FROM    PERSON t1

WHERE EXISTS (

       SELECT * FROM PERSON

       RELATE Person "IS FATHER OF" t1

       WHERE family_name LIKE 'R%'

)

So the getMainDataSourceAlias placeholder is used to point to the t1 alias used for this table.