Creating a table block
A table block displays multiple database records in a tabular format. Each row of the table shows information from one record, while each column represents a database field.
A simple table block in Preview mode
Starting the Database Wizard
- Place the insertion point anywhere in the current document.
- On the Develop menu, go to Database, click Block, and then click Table Block.
Step 1: Document Type
- Click the Script type box and select the dynamic document standard you want to use.
- Click the Database box and select the appropriate connection method for your database. (If you chose ASP as the script type, you will only be able to select ODBC.)
- Click Next.
Step 2: Data Source
- Do one of the following, depending on your selection in the Database box in Step 1 of the wizard:
- If you chose ODBC: Click the Data source box and select the ODBC data source corresponding to your database.
- If you chose MySQL:
- In the MySQL host box, enter the hostname or IP address and port number of your MySQL server, replacing the text within brackets. Also delete the brackets.
- In the MySQL DB name box, enter the name of your MySQL database.
- If you chose one of the JDBC connection methods (for a JSP document): In the Data source URL box, replace the parameters in brackets with appropriate values for your database. Also delete the brackets.
- If your data source or database is password-protected, fill in the User ID and Password boxes.
- If you chose a connection method other than ODBC in Step 1 of the wizard, click the ODBC DSN for preview box and select the ODBC data source corresponding to your database.
- Click Next.
Step 3: Database Fields
- For each database field you want to include in the table block, select the field in the box on the left and click Add. To add all the fields in a table, select the table and click Add.
- Click Next.
Step 4: Selection Statement
- If you added fields from more than one table in Step 3 of the wizard, enter a join condition in the Join box.
- If you want to filter the database records according to some criteria, enter a filter condition in the Filter box.
- If you want the records to be sorted a particular way in the table block, enter a sort condition in the Sort by box.
- Click Next.
Step 5: Block Elements
- If you want to remove one or more unnecessary block elements, select each and click Remove. (However, do not remove the Page Link Set element unless you intend to display all the records on one page.)
- Click Next.
Step 6: List Settings
- In the Number of rows box, enter the number of rows you want the table block to display on a page. (If the number of records exceeds this number, page links will be automatically inserted at the bottom of the table block so that users can see all records.)
- Click Finish.
When you finish the Database Wizard, the table block will be inserted into the current document. In Edit mode, the block will initially look something like the following:
Example of a table block in Edit mode before modification
The highlighted words “[val]” in the second row represent output elementsIn a database-driven content block, an element that displays the contents of a single database field.. These placeholders will be replaced with generated content—actual data from the database—when the document is opened in a browser. Do not delete a placeholder, unless you want to remove the corresponding block element.
The default column headers are simply the names of the database fields you selected in Step 3 of the wizard. Since these headers are static, plain text, you can replace them with any content you want.
The bottom row of the table contains a placeholder for page links that will be dynamically generated by the Web server when the number of records to be displayed exceeds the number of rows you specified for the table block.
To preview the table block with generated content, switch to Preview mode.
You can format the table block as you would an ordinary table. You
can also format the text inside it and add static content, such as images. For more information about formatting a block, see “Formatting database-driven content“.
Related topics
Joining fields from two or more database tables
Formatting database-driven content