Creating a detail block
A detail block displays a single database record. Each database field occupies one row in a table.
A simple detail 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 Detail 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 detail 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.
- In the Filter box, enter a filter condition to select the record to be displayed in the detail block. (For information about configuring a detail block to display a specific record depending on the value of a parameter in the URL, see “Using parameters with database-driven documents“.)
- Click Next.
Step 5: Block Elements
- If you want to remove one or more unnecessary block elements, select each and click Remove.
- Click Finish.
When you finish the Database Wizard, the detail block will be inserted into the current document. In Edit mode, the block will initially look something like the following:
Example of a detail block in Edit mode before modification
The highlighted words “[val]” in the right column 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 element labels in the left column 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.
To preview the detail block with generated content, switch to Preview mode.
You can format the detail 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