4D v14.3DEFAULT TABLE |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v14.3
DEFAULT TABLE
DEFAULT TABLE
Tip: Although using DEFAULT TABLE and omitting the table name may make the code easier to read, many programmers find that using this command actually causes more problems and confusion than it is worth. In particular, note that DEFAULT TABLE takes priority when you use, for example, the DIALOG command with a project form and there is a default table form with the same name. DEFAULT TABLE sets aTable as the default table for the current process. There is no default table for a process until the DEFAULT TABLE command is executed. After a default table has been set, any command that omits the table parameter will operate on the default table. For example, consider this command: FORM SET INPUT([Table];"form") If the default table is first set to [Table], the same command could be written this way: FORM SET INPUT("form") One reason for setting the default table is to create code that is not table specific. Doing this allows the same code to operate on different tables. You can also use pointers to tables to write code that is not table specific. For more information about this technique, see the description of the Table name command. DEFAULT TABLE does not allow the omission of table names when referring to fields. For example: [My Table]My Field:="A string" ` Good could not be written as: DEFAULT TABLE([My Table]) because a default table had been set. However, you can omit the table name when referring to fields in the table method, form, and objects that belong to the table. In 4D, all tables are “open” and ready for use. DEFAULT TABLE does not open a table, set a current table, or prepare the table for input or output. DEFAULT TABLE is simply a programming convenience to reduce the amount of typing and make the code easier to read. The following example first shows code without the DEFAULT TABLE command. It then shows the same code, with DEFAULT TABLE. The code is a loop commonly used to add new records to a database. The FORM SET INPUT and ADD RECORD commands both require a table as the first parameter: FORM SET INPUT([Customers];"Add Recs") Specifying the default table results in this code: DEFAULT TABLE([Customers]) |
PROPERTIES
Product: 4D
HISTORY
Created: < 4D v6 SEE ALSO
Current default table ARTICLE USAGE
4D Language Reference ( 4D v12.4) Inherited from : DEFAULT TABLE ( 4D v11 SQL Release 6) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||