This example shows how to create a dashboard page that displays a count of records and totals based on selected fields.
|
Attribute |
Description |
|
Layout Page File |
Dashboard.html |
|
Properties File |
Dashboard.xml |
|
Code Generation Tags Used |
GEN:TableStatistic |

<div align="center">
<table cellpadding="5" style="border-collapse: collapse" border="1" bordercolorlight="#C0C0C0"
bordercolordark="#C0C0C0">
<tr style="font-family:Verdana; font-size:10px">
<td colspan=3>
<p align="center">Dashboard</td>
</tr>
<tr style="font-family:Verdana; font-size:10px">
<td>Total Products</td>
<td colspan="2"><GEN:TableStatistic Name="TotalProducts"/></td>
</tr>
<tr style="font-family:Verdana; font-size:10px">
<td>Available Products</td>
<td colspan="2"><GEN:TableStatistic Name="CurrentProducts"/></td>
</tr>
<tr style="font-family:Verdana; font-size:10px">
<td>Discountinued Products</td>
<td colspan="2"><GEN:TableStatistic Name="DiscountinuedProducts"/></td>
</tr>
<tr style="font-family:Verdana; font-size:10px">
<td>Total Orders</td>
<td><GEN:TableStatistic Name="TotalOrders"/></td>
<td align="right"><GEN:TableStatistic Name="TotalOrdersAmt"/></td>
</tr>
<tr style="font-family:Verdana; font-size:10px">
<td>Total Orders 1996</td>
<td><GEN:TableStatistic Name="TotalOrders1996"/></td>
<td align="right"><GEN:TableStatistic Name="TotalOrders1996Amt"/></td>
</tr>
<tr style="font-family:Verdana; font-size:10px">
<td>Total Orders 1997</td>
<td><GEN:TableStatistic Name="TotalOrders1997"/></td>
<td align="right"><GEN:TableStatistic Name="TotalOrders1997Amt"/></td>
</tr>
</table>
</div>
This procedure shows how to create a simple dashboard by using existing database tables and views.
Step 1: Set the properties for the TotalProducts code generation tag.
|
Tag Property |
Setting |
|
Code generation tag |
TotalProducts |
|
Table, view or query |
Products To display the total number of products, we simply have to count the total number of records in the database. |
|
Display Field |
Select any field. The Field is not relevant when counting the number of records. |
|
Statistic Type |
Count |
Note: Microsoft SQL Server does not allow counting of ID fields. Iron Speed Designer automatically selects a non-ID field for counting the number of records.
Step 2: Set the data source properties for the CurrentProducts code generation tag. The additional WHERE clause limits the count to products that have not been discontinued.
|
Tag Property |
Setting |
|
Code generation tag |
CurrentProducts |
|
Table, view or query |
Products |
|
Additional WHERE clause |
Products.Discontinued = ‘False’ |
|
Display Field |
ProductName |
|
Statistic Type |
Count |
Step 3: Repeat the process for the DiscontinuedProducts tag. This time specify an additional WHERE clause with the Products Discontinued field as True.
|
Tag Property |
Setting |
|
Code generation tag |
DiscontinuedProducts |
|
Table, view or query |
Products |
|
Additional WHERE clause |
Products.Discontinued = ‘True’ |
|
Display Field |
ProductName |
|
Statistic Type |
Count |
Step 4: Set the data binding properties for the TotalOrders code generation tag.
|
Tag Property |
Setting |
|
Code generation tag |
TotalOrders |
|
Table, view or query |
Orders |
|
Statistic Type |
Count |
Step 5: Set the data binding properties for the TotalOrdersAmt code generation tag.
|
Tag Property |
Setting |
|
Code generation tag |
TotalOrdersAmt |
|
Table, view or query |
Order Subtotals Order Subtotals is a database view that contains a join between Orders and Order Details. This view contains the Order ID and a sub-total amount for all the items in an order. |
|
Display Field |
Subtotal |
|
Statistic Type |
Sum This selection will display a number that is the sum of all Subtotal fields in the database table or view. |
Step 6: Build and run the application and view the page.
To display the number of orders in 1996 and 1997 and the dollar amount of those orders, we will create two queries that will join the Orders table with the Order Subtotals database view and further restrict the records in the query based on a date rage of the year.
Step 7: Create a query by going to the Databases folder and pressing the Query tab. Name the query Orders 96. Select the Orders and Order Subtotals view. Select the four fields.