Table with Page and Grand Totals

Updated February 9, 2006
Iron Speed Designer V3.2

This example creates a table that displays page and grand totals.  The page total is the total for the records shown on the current page.  You can change the number of records displayed per page by setting the Page Size attribute of the GEN:Table code generation tag.

Description

Attribute

Description

Layout Page File

SubTotalsOnTable.html

Code Generation Tags Used

GEN:FieldStatistic and GEN:FooterTemplate

Generated Page

Layout Page File

     <div align="center">

          <GEN:Table Name="OrderSubTotals">

          <table cellpadding="5" style="border-collapse: collapse" border="1"

                        bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0">

              <GEN:HeaderTemplate>

              <tr style="font-family:Verdana; font-size:10px">

                   <td align="center">Order Id</td>

                   <td align="center">Amount</td>

              </tr>

              </GEN:HeaderTemplate>

              <GEN:ItemTemplate>

              <tr style="font-family:Verdana; font-size:10px">

                   <td>

                        <GEN:FieldValue Name="OrderId" />

                   </td>

                   <td align="right">

                        <GEN:FieldValue Name="SubTotal" />

                   </td>

              </tr>

              </GEN:ItemTemplate>

              <GEN:FooterTemplate>

              <tr style="font-family:Verdana; font-size:10px">

                   <td align="right">

                        <b>Page Total:</b>

                   </td>

                   <td align="right">

                        <GEN:FieldStatistic Name="PageTotal" Type="Sum" Scope="CurrentPage" />

                   </td>

              </tr>

              <tr style="font-family:Verdana; font-size:10px">

                   <td align="right">

                        <b>Grand Total:</b>

                   </td>

                   <td align="right">

                        <GEN:FieldStatistic Name="GrandTotal" Type="Sum" Scope="AllPages" />

                   </td>

              </tr>

              </GEN:FooterTemplate>

          </table>

          </GEN:Table>

     </div>

Procedure

Step 1:  Set the Default Table Size property to 5 for the OrderSubTotals tag.  This will display only 5 records on a page.  The Default Table Size is initially set to 20 to get 20 records per page.  To get an unlimited number of records to be displayed on the page, set the Default Table Size to -1.

Tag Property

Setting

Code generation tag

OrderSubTotals

Default table size

5

Step 2:  Build and run the application.