Tables Setup |
Top Previous Next |
To add or modify a user-defined Table, go to Maintenance / Advanced Customizations / User-defined Tables. This opens the Setup Tables dialog, which lists all current user-defined Tables and has the typical functions for Adding, Editing, etc. Note that while there are functions to Insert or Move Up and Move Down, a Table's position in the list does not affect the functionality in any way.
You can also Export one or more Table definitions to a text file, or Import Table definitions. This is primarily used for importing Table definitions created by the software provider, though it can also be used to transfer them between multiple databases. Note that the Field Definitions for the table are also Exported and Imported along with the basic table definition, but any user data in the actual tables is not exported or imported with these functions (that can be done elsewhere).
Tables cannot have duplicate Unique Names (Internal Names), since that is how the system will reference them. If you attempt to create a Table with an existing name, it will not allow it. Likewise, if you try to import a Table with an existing name, the import will fail. While it is allowed to have tables with duplicate Display Names, this is not recommended since of course it would be hard to tell which table you're using in certain functions, and could make it impossible to select one of them when building expressions.
In addition, there is a Unique ID field which cannot be duplicated. User-defined tables can be from 100 to 999. The ID is also used for internal reference (e.g. for Audit Trail entries).
Managing Tables
To Add a new Table, use Add table definition (or Insert table definition). That will open the Edit Table dialog so you can enter the table specifics, as well as manage Data Field Definitions.
Important: Once a Table is added or imported, the Names and ID (and whether it's a Pick List or not) cannot be changed. If a mistake is made, the only recourse is to Delete the table and create it again.
There is also a function here to Edit Raw Data of an existing table. You can use this to set up a user-defined Pick List (like standard Pick List editing) or manage any table's contents, just like the Raw Data Table functions for standard tables.
You can also Delete tables, but of course if there is any data in the table, that will be deleted as well. Any other functions that reference the table would also cease to function. You could, however, add a new Table definition with the same Unique Name, Unique ID, etc, essentially starting it from scratch again. Since the tables themselves are never referenced by their "Record ID", adding a table back in with the same information would restore the functionality including any linkages to it.
Referencing Tables
A Table by itself isn't very useful. You'll probably want to refer to it from some other table, or at least be able to list the records in it, add new records, etc without having to use the Raw Data Tables.
You can add functions (e.g. to the Menus) for adding records to the table, viewing the records and editing them, etc. See below for more details.
In addition, there are maintenance-type functions to view & edit the raw table (using ShowRawData) and modify the data fields (using ShowDataFields), so you can add those to the Menus as well.
One primary use of a custom table would be as a new Pick List to use in a table like Reservations. This requires a Relationship to be set up so that it can be used like other Pick Lists. See the User-defined Relationships section for details.
Another reason for creating a table would be so that you can link a number of items with specific details to another table -- for instance you could have a "Children" table with details of each child, and a Customer could have a list of Children (links to multiple records in the "Children" table). Again, that requires a Relationship setup.
Of course all other customization functions can reference your user-defined table just like any other table, e.g. Queries, Forms, Dialogs, Menus, etc., so the functionality is virtually unlimited.
Dialogs for Editing, Browsing, and Listing User-defined Tables
Once you have created a custom table (other than a Pick List), you'll want to be able to easily view and manage the records in it, like Campground Master has with functions such as Site Setup to list the Sites, and Site Details to edit the fields of a Site. Some standard functions and templates have been set up so that you don't have to create all of those functions from scratch.
First you need a way to Edit a record of your custom Table. To get a dialog for editing a record, complete with the typical browsing functions at the top like Site Details has (Next/Previous, Add, Delete, Print, etc.), you have to create a Dialog Definition for an Edit generic Record dialog. See the "The Edit Record Dialog" section later for more details.
Once you've created that dialog, there are a few ways to access it:
•AddEditRecord and EditRecord functions -- use these in a Menu definition or anywhere needed to add a new record and edit it, or edit a known record. More details are in the "The Edit Record Dialog" section.
•ShowRecordList function -- use this in a Menu definition to show a typical record-list function (like Sites Setup). It will use your Edit Generic Record add-on dialog when the Add/Edit functions are used. More details are in the "Record List Dialog" section.
Additional Topics:
Advanced Customizations Overview & other topics