The views( function lists views in open databases.
This function has two parameters:
option – option name. This parameter is optional (there can be zero or more option/value pairs). Possible option names are:
value – value corresponding with the option name.
This function lists views in open databases. The list is a carriage return separated text array, one line per view. Each line is divided into multiple fields separated by tabs. At a minimum, the first three fields list the view name, database name, and type of view (
PROCEDURE). You can also specify that additional fields be included, see below.
The views( function normally lists the views for all open databases. Use the database option if you only want to list the views for a single database. This example lists the views in the Checkbook database.
The views( function normally does not list views for library databases. This example shows how to include library databases in the list.
The views( function normally lists all types of views. Use the viewtype option to restrict the output to certain types of views: procedures, forms, or data sheet. (The data sheet view includes field names and automatic formulas and code associated with fields.) This example lists all procedures in the General Ledger database:
Note: Only the first letter of the viewtype option is considered, so you could use f instead of forms or p instead of procedures.)
The views( function normally lists the views alphabetically. If you want to list them in the order they have most recently been opened, use the
This example shows how to explicitly sort alphabetically:
This example shows how to disable sorting, so that views are listed in the actual order they appear in the database (for example, this is the order that procedures will appear in the Action menu).
Note: Only the first letter is required for the sort option, so the three examples above could be written as:
views("sort","r") views("sort","a") views("sort","n")
Use the fields option to add additional fields to the output. You can control which fields are added, and in what order. The available fields are
"recent". Here is an example that includes any error messages and source code for each view.
"source" field includes all source code associated with the view. For procedure views this means the source code of the procedure. For form views this includes all formulas, procedures, and field names that are part of objects within the form. In any case, the source code is “smushed” together. All line breaks are converted to spaces, and for forms all of the various source code items are compacted together. The purpose of the source code field is to allow searching for which views reference a particular field, variable name, function, etc. If you want to recover individual source code elements you’ll need to use other tools, for example the objectinfo( function.
"error" field will contain the error message associated with a procedure, if any. It allows you to quickly identify which procedures have syntax errors.
"recent" field will contain the number of seconds since this view was last the frontmost window.
|10.0||New||New in this version|