Go to row by row number
Focus moves to the row specified, where the row number applies to the data returned by the database.
number gotoQueryRowByKey ( any key )Go to row by primary key
Moves focus to the row corresponding to the specified key. Should only be used where the records are returned from a single table (ie., not via a query which joins multiple tables).
void doAction ( number action )Perform block level action
Invokes one of the block-level actions. These would more usually be invoked via methods like firstRecord, lastRecord, etc. The argument is the action code.
bool firstRecord ( )To to first record
Moves to the first record. If any controls in the current record have been changed, then the current record is saved; in this case, if the save fails, focus will remain at the current record, and the result is false.
void previousRecord ( )Go to previous record
Moves to the previous record. If any controls in the current record have been changed, then the current record is saved; in this case, if the save fails, focus will remain at the current record, and the result is false.
void nextRecord ( )Go to next record
Moves to the next record. If any controls in the current record have been changed, then the current record is saved; in this case, if the save fails, focus will remain at the current record, and the result is false.
void lastRecord ( )Go to last record
Moves to the last record. If any controls in the current record have been changed, then the current record is saved; in this case, if the save fails, focus will remain at the current record, and the result is false.
void addRecord ( )Add a new record
Moves to the notional empty record just beyond all retrieved records. Hence, it dows not actually add the record, rather moves to a record that will be added (ie., inserted) when saved. Equivalent to calling lastRercord and then nextRecord.
bool saveRecord ( )Save current record
The current record is saved to the database. Any control validity checks will be performed, and the operation aborted if any is invalid. The result is true if all controls were valid and the record was saved; after an error the lastError method can be used to retrieve an error message. If no controls have changed, the result is still true but no save occurs (so, strictly, the return value is true if no error occurred).
bool saveUnchecked ( )Save current unchecked
This is the same as the saveRecord method, except that no control validity checks are performed. Note, however, that an error could still occur if the data was invalid at the database server.
void deleteRecord ( )Delete current record
The current record is deleted. The result is true unless a database error occurred. After an error, the lastError method can be used to retrieve error information.
void startQuery ( )Start a query
Starts a query; this is the action invoked by the Start query menu entry or tool button. The block is set into query mode and the controls in the current record are cleared. Subsequently, either executeQuery or cancelQuery should be called.
void executeQuery ( )Execute a query
Executes a query; this is the action invoked by the Execute query menu entry or tool button. The block is reloaded with records that match the search values entered into the controls in the block.
void cancelQuery ( )Cancel a query
A query started by startQuery (or by the equivalent menu entry or tool button) is cancelled, and the data controls are restored to their prior values. This is the action invoked by the Cancel query menu entry or tool button.
void reload ( )Reload data from database
Reloads records from the database. This is equivelent to startQuery immediately followed by executeQuery, without any search values being entered into any controls.
void saveAsNewRecord ( )Save current record as new record
This is similar to the saveRecord method, except that the record is saved as a new record. In effect, data is copied into a new empty record, which is then saved.
list invalidControls ( number row, bool required, bool recurse )Get list of invalid controls
The block is checked for any data controls in the specified row which do not contain valid values (ie., which would not pass the validation checks); and, if the recurse argument is true, any nested blocks. The result is a list of invalid controls. If all controls are empty then all are considered valid (ie., this is an empty record) unless the required argument is set.
list changedControls ( number row )Get list of changed controls
Returns a list of data controls in the specified row whose value has changed, that is, data controls whose values differ from the value last retrieved from the database.
bool isInQuery ( )Test is block is in query mode
Returns a true result is the block is in query mode, that is, between a start query and execute query.