skip to main content
OpenEdge Development: AppBuilder
AppBuilder Interface : Using the TEMP-DB Maintenance tool
 
Using the TEMP-DB Maintenance tool
Now that you have a working TEMP-DB database, you can use the TEMP-DB Maintenance tool to create and modify temp-table definitions. The tool shows all the temp-tables currently defined in the TEMP-DB database in the browser. You can add others by either creating them in the tool or importing include files that contain the definitions.
TEMP-DB control records
The browser in the upper part of the TEMP-DB Maintenance tool shows all the temp-tables defined in the database and the corresponding records in the temp-db-ctrl table. You can sort on any column by clicking its label. Table 6 describes the fields in the browser.
 
Table 6: TEMP-DB control records
Field
Description
Table Name
Name of the table in the TEMP-DB database.
Source File
Name and relative path of the include file containing the temp-table definition.
Use Include
Indicates whether a data object using the temp-table should use an include file reference or a LIKE construct. The default (Yes) is to use an include file reference.
Date Modified
Date and time the table was last rebuilt with this tool.
File Changed
Indicates whether the date of the current source file is different than the date of the source file used for the last rebuild. Use this information to identify which files have changed since the last rebuild.
Status
Provides information about events that occurred during the last rebuild of the TEMP-DB database or during the last compare operation. The possible values are as follows:
*Mismatched — The source file and the TEMB-DB structure do not match. This value is assigned after a compare or rebuild operation. Records with this value show as red in the browse.
*Matched — The source the TEMB-DB structure match. This value is assigned after a compare or rebuild operation. Records with this value show green in the browse.
*File not found in Propath — Source file could not be found in the Propath.
*Control Record not found — Control record could not be found in the temp-db-ctrl table. This might occur if a temp-table was added outside of the tool.
*Table Tablename not found — Table specified in the control record does not exist in the TEMP-DB database. This might occur if a temp-table was deleted outside of the tool.
Entity Imported
In Progress Dynamics, this indicates that the table was successfully imported into the Repository with this tool. This field only appears in the Progress Dynamics environment.
User
In Progress Dynamics, this identifies the user who last modified the records. This field only appears in the Progress Dynamics environment.
Defining a new temp-table
Defining a new temp-table is as simple as typing the definition into the editor on the Source File tab.
To define a new temp-table:
1. Click New source file in the editor. If there are no records in the TEMP-DB database, the editor is initialized automatically.
2. Type the following code into the editor:
 
DEFINE TEMP-TABLE ttMyTest NO-UNDO
  FIELD testField1 AS CHARACTER
  FIELD testField2 AS DECIMAL.
3. Right-click in the editor and choose Check Syntax to ensure the syntax is correct.
4. Click Save. The Save File dialog box appears.
5. Save the file in your working directory as ttMyTest.i.
The tool rebuilds the TEMP-DB database to include your new temp-table and displays its control record in the browser.
If you have your application database connected, there are some options that can make defining the temp-table easier. In the following example, the DynSports sample database is used. The DynSports database is a version of the Sports database that has been rebuilt using the Progress Dynamics recommended practices.
To define a temp-table from a table in a connected database:
1. Connect to a copy of the DynSports database.
2. Click New source file on the Source File tab.
3. Right-click inside the editor and choose InsertTable Definition from the pop-up menu. The Table Selector dialog box appears:
4. Select arm_customer from the Tables list and click OK. The tool creates a temp-table definition to match the selected table:
5. Change the temp-table’s name to ttCustomer.
6. Modify the definition to suit your purpose for the temp-table. For example, if you are not going to use the Progress Dynamics key fields (_obj), you can remove them and their associated indexes.
7. Save the temp-table in your working directory as ttCustomer.i.
Importing temp-table definitions
You can also define temp-tables in the TEMP-DB database by importing existing include files. You can write many temp-table definitions in a single file and then import them all at once. You only have to rebuild the TEMP-DB database once to add all the temp-tables in one file.
To import existing temp-table definitions:
1. In the Procedure Editor, type the following code in a new file:
 
DEFINE TEMP-TABLE ttImport1
  FIELD testField1 AS CHARACTER
  FIELD testField2 AS DECIMAL
  FIELD testField3 AS INTEGER.
 
DEFINE TEMP-TABLE ttImport2
  FIELD testField1 AS CHARACTER
  FIELD testField2 AS DECIMAL
  FIELD testField3 AS INTEGER
  FIELD testField4 AS DATE.
 
DEFINE TEMP-TABLE ttImport3
  FIELD testField1 AS CHARACTER
  FIELD testField2 AS DECIMAL
  FIELD testField3 AS INTEGER
  FIELD testField4 AS DATE
  FIELD testfield5 AS LOGICAL.
2. Save the file in your working directory as ttImportTest.i.
3. Select the File Import tab from the TEMP-DB Maintenance tool:
4. Browse to your working directory and click Fetch Files. The Fetched Files list shows all the include files from your working directory.
Note: The Directory field displays the last directory you specified in this tool.
5. Double-click on ttImportTest.i to move it to the Selected Files list. The Rebuild TEMP-DB button is enabled:
6. Click Rebuild TEMP-DB. The browser displays a separate record for each imported temp-table definition.
7. Select one of the imported temp-tables in the browser, and select the Source File tab:
Note that you see the full contents of ttImportTest.i in the editor. You can edit any of the definitions in the file. The appropriate record is updated when you save your changes.
Viewing temp-table details
With the TEMP-DB Maintenance tool, you can view the details of any temp-table in the TEMP-DB database. While this does not allow you to edit the temp-table definitions, it is more convenient when reviewing temp-table definitions.
To view temp-table details:
1. Click View TEMP-DB schema details . The Schema dialog box appears:
If you select another table in the Tables list, the other lists update to display the information for that table.
2. Click Table Details. The Table Details dialog box appears:
3. Click Field Details in the Schema dialog box. The Field Details dialog box appears:
4. Click Index Details in the Schema dialog box. The Index Details dialog box appears:
Editing temp-table definitions
You can edit the temp-table definitions through the TEMP-DB Maintenance tool. You can make your changes either in the tool’s editor or by launching the Procedure Editor from the tool.
To edit a temp-table definition:
1. Select ttMyTest in the browser.
2. Add the following code to the temp-table definition in the editor:
 
INDEX testIndex1 IS PRIMARY testField2 ASCENDING
Note: Alternately, you can click Open source file in editor to launch the Procedure Editor as a separate window.
3. Click Syntax to check that the code is correct.
4. Click Save. The TEMP-DB record for that table is rebuilt. You can view the temp-table definition to verify that the index information was added to the schema.
Verifying a definition against its source
When you build an object in the AppBuilder that uses a temp-table, the run-time code references the source include file by default. But, the AppBuilder uses the definition in the TEMP-DB database during design time. Therefore, you want to be sure that the records in the TEMP-DB database match the definition in the source file. Any changes in the source file should be imported into the TEMP-DB database before you use the temp-table to build an object.
Note: If you want to automate the updating of temp-table definitions, you can configure the ADE tools to automatically rebuild the TEMP-DB database when files are saved. To set this option, choose OptionsPreferences in the TEMP-DB Maintenance tool.
To verify the TEMP-DB definition against the source file:
1. Open ttImportTest.i in the Procedure Editor.
2. Add testIndex1 to the definition for ttImport1:
 
INDEX testIndex1 IS PRIMARY testField2 ASCENDING
3. Check the syntax, save your change, and close the Procedure Editor.
4. Select ttImport1 in the browser and click Compare source file with schema . After the tool compares the TEMP-DB record with the source file’s code, the Compare Window appears with the results:
5. Close the Compare Window and examine ttImport1 in the browser:
Note that the Status field now shows a value of Mismatched Record. Also note that the record now appears in red to draw your attention to it. When you are maintaining a large number of temp-tables, you can use the Filter combo box to find all the temp-tables with a given status.
Rebuilding the TEMP-DB schema
When a mismatch occurs, you can update the TEMP-DB schema to match the source file definition.
To rebuild the schema:
1. Select ttImport1 in the browser.
2. Click Rebuild TEMP-DB. A message appears to verify that you want to rebuild the record:
3. Click Yes to rebuild the record.
4. Click View TEMP-DB schema details . Examine the new index in the Schema dialog box: