|
Recipe: Manipulate table data from code
DataWeb is based on a RDBMS (HSQLDB or Postgres) but usually you don not use SQL to query data. It could be useful from code to manipulate some data not directly connected to the open form.
This code could be used:
// Get an active table object dataweb.client.Table tbl=client.openTable(session, "<Package>.<Table>");
// Move cursor to required record tbl.seek("<Index Name>",new Object[]{<Index parameter1>[,<Index parameter2>]})
// We want to edit some data tbl.edit(); tbl.setValue("<Field Name>",<Value>); tbl.update();
// Create new record tbl.addNew(); tbl.setValue("<Field Name>",<Value>); .... .... tbl.setValue("<Field Name>",<Value>); tbl.update();
// Close table object tbl.close();
|