Please enable JavaScript to view this site.

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

SQLQuery class: addField

Scroll Prev Next More

 

Adds a field name to the end of the SELECT clause of the current SQL query.

 

Note: SQLQuery class methods are used in the After table initialized event.

Syntax

addField calculatedField, alias

Arguments

calculatedField

the name of the field. Example: "size".

alias

an alias of the field name. Example: "new_size".

Note:alias field values can be used in the following events:

Before record processed, After record processed for the List page like data(alias);

Process record values, Before display for the Edit page like values(alias);

Copy page: Onload, Before record added, After record updated, Process record values for the Add page like values​​ (alias);

Process record values, Before display for the View page like values(alias).

Return value

No return value.

Example 1.

To add now() as 'current_date' to the end of the SELECT clause:

 

query.addField "now()", "current_date"

Example 2.

To add 'size'+'adjust' as 'new_size' to the end of the SELECT clause:

 

query.addField "size+adjust", "new_size"

See also:

SQLQuery class: deleteField

SQLQuery class: replaceField

Grid Row JavaScript API: row.getFieldValue()

Event: AfterTableInit

SQL tab

Table events

About SQLQuery class