Case Study #32 - Multiple MagicLayout Objects Template Example

This example has three modules. Module #1 generates a GRID and module #2 generates a PIE CHART. The last module acts as a "checkout" and position the GRID and CHART objects according to the tags in the template in conjunction with the HTML codes.
Note that a navigation bar (NAVBAR) object pertaining to the particular GRID in the module is automatically available when a GRID is generated.

Updating the grid will also update the chart in this example. dbDisplay must be set to true before executing ASPdbSendTemplate.


Example #1 -

<%
Set X=Server.CreateObject("Asp.DB")
X.dbQuickProps="1;NWIND;;grid;4,,lightgreen;;;ACCESS;5;1;1"
X.dbSQL="SELECT DISTINCTROW ProductName, UnitPrice FROM Products Order by UnitPrice DESC"
X.dbMagicLayout="1;GRID"
X.dbDisplay=false
X.ASPdb

Set X=Server.CreateObject("asp.db")
X.dbQuickProps="1;NWIND;;grid;4,,lightgreen;;;ACCESS;5;1;1"
X.dbSQL="SELECT DISTINCTROW ProductName, UnitPrice FROM Products WHERE UnitPrice > 0 Order by UnitPrice DESC"
X.dbDisplay=false

X.dbMagicLayout="(;,#~|)2;CHART_26,http://www.site.com/aspdb,350,350,1,1;dataset0Labels~dataset0yValues;#0#~#1#;Title=NorthWind Products Unit Price| TimesRoman,14,1~Legend=True| ^2| Transparent| ^3| 0.04| 0.03 ~ Effect=^2| True~Pie=^2| True| ^3| .6| .6| .5| .5"

X.dbOptions="SortToggle=false"
X.aspdb

Set X=Server.CreateObject("asp.db")
X.dbDisplay=true
X.ASPdbSendtemplate("Simple_template.htm")
%>

Template File (Simple_template.tmp)

<TABLE border=1><TR>
<TD ColSpan=2 align=center><B>Template Charting Demo</B></TD></TR>
<TR><TD><CENTER>[[aspDB_Layout_1_1:S]]<BR>[[GRIDNAVBAR_1:S]]&nbsp;</CENTER></td>
<td>[[aspDB_Layout_1_2:S]]</td></tr>
</table>



Browser Output -