Replaces a field name in the SELECT clause of the current SQL query with a new one.
Note: SQLQuery class methods are used in the After table initialized event.
Syntax
replaceField(replaceableField, calculatedField, alias)
Arguments
replaceableField
a field name to be replaced. Example: "size".
calculatedField
a new field name. Example: "new_size".
alias
an alias of the new field name.
Note: the alias parameter can be omitted. In this case, replaceableField value is taken as alias.
Return value
No return value.
Example 1
Replace the 'name' with the 'englishName' as 'name':
query.replaceField("name", "englishName");
Example 2
Replace the 'price' with the 'price*1.2' as 'price':
query.replaceField("price", "price*1.2");
See also: