Please enable JavaScript to view this site.

Navigation: Advanced topics > Programming topics > SQLQuery class > Methods

SQLQuery class: replaceField

Scroll Prev Next More

 

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:

SQLQuery class: addField

SQLQuery class: deleteField

SQL tab

Event: AfterTableInit

About SQLQuery class