Tornado Demo - MagicCell - Master with embedded Details
Can you image you can do this with 11 lines of code?

IDCustomerOrders
ALFKI Alfreds Futterkiste
Obere Str. 57
Berlin, 12209

Maria Anders
Obere Str. 57
030-0074321

1070211/13/9512/25/9511/21/951095204/15/9605/27/9604/23/96
1083502/15/9603/14/9602/21/96
1101105/09/9606/06/9605/13/96
ANATR Ana Trujillo Emparedados y helados
Avda. de la Constitución 2222
México D.F., 05021

Ana Trujillo
Avda. de la Constitución 2222
(5) 555-4729

1062509/08/9510/06/9509/14/951092604/03/9605/01/9604/10/96
1075912/29/9501/26/9601/12/96
ANTON Antonio Moreno Taquería
Mataderos 2312
México D.F., 05023

Antonio Moreno
Mataderos 2312
(5) 555-3932

1050705/16/9506/13/9505/23/951057307/20/9508/17/9507/21/951067710/23/9511/20/9510/27/951085602/28/9603/27/9603/12/96
1053506/13/9507/11/9506/21/95
1064309/25/9510/23/9510/03/95
1068210/26/9511/23/9511/01/95
AROUT Around the Horn
120 Hanover Sq.
London, WA1 1DP

Thomas Hardy
120 Hanover Sq.
(171) 555-7788

1045303/24/9504/21/9503/29/951070711/16/9511/30/9511/23/951074312/18/9501/15/9612/22/951079301/24/9602/21/9602/08/961092004/02/9604/30/9604/08/961101605/10/9606/07/9605/13/96
1055807/05/9508/02/9507/11/95
1074112/15/9512/29/9512/19/95
1076801/08/9602/05/9601/15/96
1086403/04/9604/01/9603/11/96
1095304/15/9604/29/9604/24/96
BERGS Berglunds snabbköp
Berguvsvägen 8
Luleå, S-958 22

Christina Berglund
Berguvsvägen 8
0921-12 34 65

1044403/15/9504/12/9503/24/951052406/01/9506/29/9506/07/951062609/11/9510/09/9509/20/951067210/18/9511/01/9510/27/951073312/08/9501/05/9612/11/951083702/16/9603/15/9602/23/961086603/05/9604/02/9603/14/961092404/03/9605/01/9605/08/96
1044503/16/9504/13/9503/23/95
1057207/19/9508/16/9507/26/95
1065410/03/9510/31/9510/12/95
1068911/01/9511/29/9511/07/95
1077801/16/9602/13/9601/24/96
1085702/28/9603/27/9603/08/96
1087503/08/9604/05/9604/02/96

bottom next goreload

[1 - 5 : 91]

Magic - Embedded Details
<script language="VB" runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
  Dim E64 As New Tornado.z
  With E64
    .dbQP = "U=60| S=11|D=Nwind|gdf=CustomerID, CompanyName, ContactName"
    .dbGridMagicCell = "(;![]#|~/+{})field=CompanyName|Macro=#1#<br>#4#<br>#5#, #7#<p>#2#<br>#4#<br>#9#!field=ContactName|Macro=SQL0:SELECT OrderID,OrderDate,RequiredDate,ShippedDate from orders where customerID= '#0#'"
    .dbNameMap = "field=CustomerID|alias=ID,field=CompanyName|alias=Customer,field=ContactName|alias=Orders"
    .dbEmbeddedGridNameMap = "field=OrderID|alias=ID,field=OrderDate|alias=Ordered,field=RequiredDate|alias=Required,field=ShippedDate|alias=Shipped"
    .dbSQL = "SELECT CustomerID,CompanyName,ContactName,ContactTitle,Address,City,Region,PostalCode,Country,Phone,Fax FROM Customers"
    .dbTextHolder = "Title=Tornado Demo - MagicCell - Master with embedded Details|subtitle=Can you image you can do this with 11 lines of code?"
    .ASPdbNET()
  End With
End Sub
</script>
I came across a similar example like this one in a popular DotNet site. The size of that example is a couple hundred lines of code. It went pretty deep and it is safe to assume that you have to read some DotNet books for a couple of months before you can do one of this application yourself. I get into ASPdb.Net and came out with a total of about 30 lines of code including the master and popped up detail tables and a business chart. The most important aspect is that these 30 lines of code can be used by every ASP-db user and they do not even have to know about DotNet.
Essentially what is happening here is that a master grid is displayed after a query from the Customers table. The third displayed field is used as a dummy and an embedded SQL retrieving all the orders belonging to the customer are executed and the result is placed in this dummy cell. The OrderID is then used a key to retrieve the details of the order. The results is presented in a popup window so the main table stays intact. While the Subtotal is calculated by the SQL, the column totals are calculated by the dbAggregate function. Note that column totals can have different formats as it should. Doing this with the Web control got to be a challenge. This three levels master details can be done in very few lines of code. Finally I picked the Description and SubTotal columns and plot that in a Spinning Pie chart with 2 additional lines of code.

Send comments on this topic.
Copyright (c) 1998-2006 ASP-db