Generate layout objects to be placed onto the template. This is one of the two methods to place data onto the template. The other method is to use a direct template like FormTemplate, FilterTemplate, EditUpdateTemplate, EditDeleteTemplate, EditAddTemplate. For older browsers that cannot print Java bitmaps, a feature called gifButton will place a button (Java) at the bottom of the chart and clicking it will open a new window with the identical chart in it in a gif format. User can then save or print this gif image. gifButton is supported by Designer also.

Property Syntax

Syntax 1
Obj.dbMagicLayout="(;,#)ID; GRID"

Syntax 2
Obj.dbMagicLayout="(;,#)ID; BLOCK, Across, PatchStr, BHeader, BFooter, CellBegin, CellEnd, RowBegin, RowEnd;;BLOCKMagicMacro"

Syntax 3
Obj.dbMagicLayout="(;,#)ID; SELECTBOX; Tags; SelectBoxMagicMacro"

Syntax 4
Obj.dbMagicLayout="(;,#~|)ID; CHART_???, Codebase, Width, Height, Start, Interval, Stop; ChartDataSet; DataSetMagicMacro; PARAMS; gifButtontext, Button X Dimension, Button Y Dimension"


Parameter Description
(;,#~|) Group, Field, MagicMacroWrap, ChartDataSet and ChartDataSetField default delimiters. The ChartDataSet and ChartDataSetField delimiters apply only to syntax #4 and are carried over to the dbUserChartData property.  See Chart Parameters for details.
ID ID of the object generated from a unit. Multiple objects can be generated from a single module (unit). This ID is used to identify these objects.
GRID Generate a grid object without the navigation and status bars. This object is identical to the one displayed under normal conditions. This grid will be stored as session variable "ASPdb_Layout_Unit_ID". When a GIRD object is generated, a corresponding navigation bar will be automatically generated as session variable "NAVBAR_Unit".  Since grid is related directly to the SQL therefore only (1) GRID can be generated by any (1) module. For example, one module/unit can generate only one grid but can generate 4 CHARTs, 5 BLOCKs and 6 SELETBOXs by specifying different IDs.
BLOCK Generate a BLOCK object. A BLOCK object is composed of all the cells of a column.  Cells are wrapped  by head, foot, rowbegin, rowend, cell begin and cellend tags. Differnt combinations of these tags can create many different effects. BLOCK objects are very effective in presenting images.
Across Display configuration of a BLOCK. This parameter consists on 3 parts, Size, Direction and Orientation. Default (blank)="1RH". The "Size" part must be at the beginning and the Direction and Orientation part sequence is not significant.

Size = How many Rows or Columns
Direction = Rows or Columns
Orientation = Vertical or horizontal population.

Example -




1 2 3 4
5 6 7 8
9 10    
1 5 9
2 6 10
3 7  
4 8  
1 2 3
4 5 6
7 8 9
1 4 7 10
2 5 8  
3 6 9  
PatchStr If there are 10 items and across=3 there will be 2 blanks left after filling from left to right. This string will be used to fill in this 2 blank cells.
Bheader In a table, this will be the <TABLE> tag. In a List This will be a <OL> or <UL> tag.
BFooter In a table, this will be the </TABLE> tag. In a List This will be the </OL> or </UL> tag.
CellBegin In a table, this will be the <TD> tag. In a List This will be the <LI> tag.
CellEnd In a table, this will be the </TD> tag. In a List This will be the "" (blank).
RowBegin In a table, this will be the <TR> tag. In a List This will be the "" (blank).
RowEnd In a table, this will be the </TD> tag. In a List This will be the "" (blank).
BlockMagicMacro This the the MagicCell like macro for the BLOCK.
SELECTBOX Generate a SELECTBOX just like the regular dbSelectbox except that this SELECTBOX object can be placed anywhere in the template. This is a very useful object and often used as a key driver to the entire template.
Tags e.g. SIZE=3 MULTIPLE. Use this tag to configure MULTIPLE selects. The results will be in ->
Session("SV_SelectBoxItem_Unit") = Select1,Select2....
SelectBoxMagicMacro This the the MagicCell like macro for the SelectBox.
CHART_??? Generate a Java Chart applet and create the chart in the client browser. ???=1 to 28. See the charting section for details.
Codebase The virtual directory that sits on top of the javachart directory. See Java Chart  installation section for details.
Width, Height Width and height of chart in pixels.
Start, Interval, Stop Which datapoint to start plotting and how many points to skip as interval and which datapoint to stop plotting. These parameters are provided to control the plotting of a large number of datapoints.
ChartDataSet Sequence of datasets. For examle - dataset0Labels,dataset0yValues means, the first set is the X axis and the second set is the Y axis.
DataSetMagicMacro These are the datapoints sets that corresponding to the ChartDataSet. For example - #0#~#1# means the X axis is the #0# column and the Y axis is the #1# column of the recordset.
PARAMS Chart parameters (See Chart Parameters)
gifButtonText Text of gifButton, default="Render Gif File"
gifButton Dimension width, height (pixels) e.g. 300x35 default=88,28
gifButton Stub File virtual path of ASPdbDisplay.asp file. e.g. ../aspdb/Jars/ASPdbDisplayGif.asp. This stub file is included in the installation package and should not be modified. It defaults to the ASP-db system Jars directory. 

Example - Grid

Set X=Server.CreateObject("AspDB.EP2K")
X.dbSQL="SELECT DISTINCTROW ProductName, UnitPrice FROM Products Order by UnitPrice DESC"
response.write("<center><h3>This is a GRID Object<h3>" & session("ASPdb_Layout_1_123") & "</center>")

wpe3.jpg (12523 bytes)

Example - BLOCK

Set X=Server.CreateObject("ASP.DB")
X.dbSQL="SELECT DISTINCTROW ProductName, UnitPrice FROM Products Order by UnitPrice DESC"
X.dbMagicLayout="(|,)9|BLOCK,3,&nbsp;,<TABLE Border=1>,</TABLE>,<TD>,</TD>,<TR>,</TR>||#0# sells for <font color=blue>#1#</font>"
response.write("<center><h3>This is a BLOCK Object</h3>" & session("ASPdb_Layout_1_9") & "</center>")

dbMagicLayout2.gif (3601 bytes)

Instead of using a template to display the BLOCK object, only the session variable containing the object ("ASPdb_Layout_1_9") is displayed.

This block object  layout the cell values in 3 across. The "left over" cells are patched with the patchStr "&nbsp;". This block employs the <table> construct. If a <List> construct is preferred then the change the dbMagicLayout property to -

X.dbMagicLayout="(|,)9|BLOCK,3,,<OL type=1>,</OL>,<LI>,,,||#0# sells for <font color=blue>#1#</font>"

dbMagicLayout3.gif (3075 bytes)


Set X=Server.CreateObject("ASP.DB")
X.dbMagicLayout="1;SELECTBOX;;[#0#] #FirstName# #LastName#"

Set Y=Server.CreateObject("ASP.DB")
Y.dbSQL="SELECT * from Orders WHERE EmployeeID = " & session("ASPDB_3_EmployeeID")
Y.dbFormTemplate=dir & "dbMagicLayout1.tmp"
Y.dbOptions="NavTableTag=cellspacing=2 cellpadding=1 border=1"
Y.dbDisplayLookUpList="(;|)EmployeeID||SELECT EmployeeID, FirstName & ' ' & Lastname as Name FROM Employees"

This example generates a selectbox from the employees table in module #3 and export the selected emplyeeid (#0#) to module #5 to construct the SQL statement. A form is generated and the final display is presented by the form template instead of a regular Form. Note that in a FormTemplate, all the form fields are available as a simple [[fieldname]] tag. Note that the Selectbox is producing the recordset and the navigation buttons is functional and navigate among this recordset in a user configurable form mode..All this in 14 lines of ASP-db code..

Template File - (dbMagicLayout1.tmp)

<CENTER><h2>SelectBox Layout Demo</h2>
<B>Order ID =</B> <font color=Red>[[OrderID]]</font><BR>
<B>Customer ID =</B> <font color=Red>[[CustomerID]]</font><BR>
<B>Employee Name =</B> <font color=Red>[[EmployeeID:M]]</font><BR>
<B>Order Date =</B> <font color=Red>[[OrderDate]]</font><BR>
<B>Required Date =</B> <font color=Red>[[RequiredDate]]</font><BR>
<B>Shipped Date =</B> <font color=Red>[[ShippedDate]]</font><BR>
<B>Ship Via =</B> <font color=Red>[[ShipVia]]</font><BR>
<B>Freight =</B> <font color=Red>$[[Freight]]</font><BR>
<B>Ship Name =</B> <font color=Red>[[ShipName]]</font><BR>
<B>Ship Address =</B> <font color=Red>[[ShipAddress]], [[ShipCity]], [[ShipRegion]] [[DisplayNonBlank:ShipRegion:,]] [[ShipPostalCode]], [[ShipCountry]]</font><P>

Pay attention to the [[DisplayNonBlank:ShipRegion:,]] tag in the template file. This tag signals only if the ShipRegion field is not blank (Null or Empty) then display the third magic parameter which is a comma (,). If this tag is not there and instead a comma is in place like the rest, then an extra comma will be displayed when the ShipRegion is blank. This feature is used in this example to control the display of a comma while it is very effective in controlling action button display in the template.

Pay attention to the [[EmployeeID:M]] tag in the template file. Note that the Labels is "Employee Name" and that implies that a lookup is occuring via the Y.dbDisplayLookUpList property. The default is the raw value of the field. If the "M" value (Magic) is desired then the [[:M]] switch has to be added. The "M" switch will sends the field value through the MagicCell filter which includes Lookup.

Browser Output - SELECTBOX

dbMagicLayout4.gif (4894 bytes)


Example - CHART

See Chart Layout example in ASPdbSendTemplate
See Chart Layout example in dbUserChartData