|
 |
The
Table object represents a data table in a DataWeb application.
Constructor
Web.tables.add(tablename) |
Creates a new table on the file hierarchy, and returns a new table object instance. See the add()method of the Tables collection for detailed information. |
Web.tables.fetch(tablename) |
Returns a table object instance based on the specified table. See the fetch()method of the Tables collection for detailed information. |
|
Prototype
Methods
bulkDelete |
Deletes
multiple records of a data table.
|
bulkInsert
|
Inserts multiple records into a data table. This method also allows you to transfer data from one data table to another data table. |
bulkUpdate |
Updates
multiple records of a data table.
|
delete
|
Deletes
one record from a data table. |
exists
|
Checks to see if the specified data table exists in the current application. |
insert |
Inserts
one record into a data table.
|
remove
|
Removes a specified data table from the current application. |
select |
A
new Resultset instance is constructed and
returned.
|
update |
Modifies
one record of a data table.
|
|
Instance Properties
fields |
Returns an object representing the fields of the data table. The properties of this object are Field object instances. |
indexes |
Returns an object representing the indexes on the data table. The properties of this object are Index object instances. |
name |
Returns the name of the data table. |
version |
This property gives the version of the data table on the last occasion that the table instance took a snapshot of the data table. (The data table version and the table instance version will go out of synch when the data table schema is changed, for example, if a field is added or removed. But adding or removing data from the data table will not make the versions go out of synch.) Use the refresh() method to update the table instance's snapshot of the data table. |
|
Instance Methods
exists |
Checks to see if the data table represented by tableInstance exists. |
getCaption |
Returns the data table's caption. |
getDefaultDisplayField |
Retrieves the default display field as set by setDefaultDisplayField. |
getDefaultSortField |
Retrieves the default sort field as set by setDefaultSortField. |
getDescription |
Returns the data table's description. |
getPrimaryKey |
Returns the data table's primary key. |
getFolderPath |
Returns the folder in which the data table resides. |
isValid |
Checks to see if the table instance's snapshot of the data table is up to date. This method returns FALSE if the version property of the table instance is different from the current data table version. |
indexes |
Creates, retrieves and deletes indexes on the
data table. |
refresh |
This method takes a new snapshot of the data table, i.e., it refreshes the properties of the table instance based on the current properties of the data table. |
remove |
Removes a data table from the application. |
setCaption |
Sets the data table's caption. |
setDefaultDisplayField |
Sets the default display field for other other tables which look up this table. |
setDefaultSortField |
Sets the default sort field for other other tables which look up this table. |
setDescription |
Sets the data table's description. |
setPrimaryKey |
Sets the data table's primary key. |
|
Example
The following example code demonstrates the Table object methods.
webcall function TableMethods()
{
var tableRead = Table.select("AddressBook", "LastName, FirstName",
"LastName='Smith'");
// Add a record, i.e. a row, to the AddressBook data table
Table.insert("AddressBook", {LastName:"Jones",
FirstName:"Mary", Email:"maryjones@address.com"});
// Change the entry of the Ingredients column for row "4" to
// "Orange".
Table.update("AddressBook", {Email:"someperson@someaddress.com"}, 4);
// Delete a row designated by the RowId value.
Table.delete("AddressBook", 5);
// Perform a bulk update on the field "Zip" with the
// data "98105-6001" for rows whose Address1
// entry begins with "DataWeb Corporation".
Table.bulkUpdate("AddressBook", {Zip:"98105-6001"},
"Address1 LIKE 'DataWeb Corporation' ", false);
// Perform a bulk delete on all the records that have an empty
// LastName column.
Table.bulkDelete("AddressBook", "LastName IS NULL ", false);
}
Related Topics Fields Collection, Indexes Collection
|