Record Tag

Purpose

The Record code generation tag groups multiple FieldValue code generation tags so that the generated code is optimized.  If there is no enclosing Record tag, each FieldValue will be generated with its own enclosing RecordControl Presentation Layer control tag.  You can specify the selection criteria used to select the record in the tag’s Properties dialog.

The Record tag, used in conjunction with FieldValue tags, displays multiple fields from the same database record.

FieldValue tags are often grouped within an enclosing Record tag as shown below.  The Record tag groups together FieldValue tags that fetch and display data from the same physical record.  This is the most convenient way to optimize the generated code because a single SQL query is generated for the Record and associated FieldValue tags.  If there is no enclosing Record tag, each FieldValue will be generated as a separate control with its own SQL query.  You can specify the selection criteria used to select the record in the tag’s Properties dialog.

<HTML>

<body>

     <GEN:Record Name=”Customer”>

          <td><GEN:FieldValue Name="FirstName"/></td>

          <td><GEN:FieldValue Name="LastName"/></td>

          <td><GEN:FieldValue Name="Address"/></td>

          <td><GEN:FieldValue Name="City"/></td>

          <td><GEN:FieldValue Name="State"/></td>

          <td><GEN:FieldValue Name="ZipCode"/></td>

          <td><GEN:FieldValue Name="Country"/></td>

          <td><GEN:FieldValue Name="PhoneNumber"/></td>

     </GEN:Record>

</body>

</HTML>

You may wonder as to the difference between using FieldValue tags enclosed within a surrounding Record tag and just using plain FieldValue tags without a surrounding Record tag.  There are several benefits to using a surrounding Record tag:

  1. The enclosed FieldValue components will all use the same record.  When FieldValue tags are used separately without an enclosing Record tag, there is no guarantee that each FieldValue will use the same underlying database record.  It is possible for each of them to display data from a different database record, making it impossible to synchronize the display of related fields.  Using an enclosing Record tag solves this problem.

  2. Component configuration is simplified.  You can set the Record tag’s Query properties to the appropriate database table, saving effort when configuring the enclosed FieldValue tags.

HTML Use Inside Record Tags

There are no restrictions on the HTML included within an enclosing Record tag.  HTML and other code generation tags can be intermingled with the FieldValue tags within an enclosing Record tag, as shown in the following example.

<HTML>

<body>

     <GEN:Record Name=”Customer”>

          <B>Bill To:</B><br>

          <GEN:FieldValue Name="FirstName"/> <GEN:FieldValue Name="LastName"/><br>

          <GEN:FieldValue Name="Address"/><br>

          <GEN:FieldValue Name="City"/>, <GEN:FieldValue Name="State"/>

          <GEN:FieldValue Name="ZipCode"/><br>

          <GEN:FieldValue Name="Country"/><br>

          Phone: <GEN:FieldValue Name="PhoneNumber"/><br>

          FAX: <GEN:FieldValue Name="FAX"/><br>

     </GEN:Record>

</body>

</HTML>

After configuring the components and generating the application, the following page is displayed.

FieldValue tags within an enclosing Record tag ensure that each field displayed is from the same record.  Any HTML and other code generation tags may be included within an enclosing Record tag.

Nested Record Tags

Nested Record tags are used to display one-to-one relationships between two database tables with a foreign key relationship between them.  The inner Record tag is bound to the "parent" table of the foreign key relationship, while the outer tag (also a Record tag) is bound to the "child" table of the foreign key relationship.  This is because the outer Record tag's foreign key value will affect the inner Record.

Binding Properties

The Query Properties specify which records are selected for display or editing.

Pass-Through Attribute Properties

See also: Record Pass-Through Attribute Properties

Used In

HTML Layout Pages and Page Templates

Code Generation Tag Attributes

Attribute

Required

Description

Name

Yes

The name of this tag.  This name must be unique within the file and cannot contain spaces.

The Record tag generates a RecordControl Presentation Layer control tag.  The Presentation Layer control tag specifies the selection criteria (query) used to select the record from the database.

Examples

     <GEN:Record Name=”OrderRecord”>
          <GEN:FieldValue Name=”OrderNumber”/>
          <GEN:FieldValue Name=”OrderDate”>
          <GEN:FieldValue Name=”CustomerName”/>
     </GEN:Record>