Form Block Methods (inherits Block)

void gotoQueryRow ( number row )

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

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

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

void executeQuery ( )

Execute a query

void cancelQuery ( )

Cancel a query

void reload ( )

Reload data from database

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

list changedControls ( number row )

Get list of changed controls

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.