beginAppend( ) example
The following event handler is used to add new rows. It carries over the values of some fields from the current row.
function addButton_onClick( )
local cCity, cZip, cInsp
// Make copies of field values to carry over
cCity = form.rowset.fields[ "City" ].value
cZip = form.rowset.fields[ "Zip" ].value
cInsp = form.rowset.fields[ "Inspector" ].value
// Add new row
if form.rowset.beginAppend( )
form.rowset.fields[ "City" ].value := cCity
form.rowset.fields[ "Zip" ].value := cZip
form.rowset.fields[ "Inspector" ].value := cInsp
form.rowset.modified := false // Clear flag to set baseline for change
endif
The field values are copied only if beginAppend( ) succeeds. It could fail if the current row has been modified, but contains invalid data. In that case, you would not want to overwrite the current field values and clear the modified flag.