commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r9248 - trunk/gnue-samples/two-tier/forms


From: reinhard
Subject: [gnue] r9248 - trunk/gnue-samples/two-tier/forms
Date: Tue, 9 Jan 2007 14:54:40 -0600 (CST)

Author: reinhard
Date: 2007-01-09 14:54:39 -0600 (Tue, 09 Jan 2007)
New Revision: 9248

Modified:
   trunk/gnue-samples/two-tier/forms/items.gfd
Log:
Updated items form to use joins as master/detail can't be used in this case.


Modified: trunk/gnue-samples/two-tier/forms/items.gfd
===================================================================
--- trunk/gnue-samples/two-tier/forms/items.gfd 2007-01-09 20:53:37 UTC (rev 
9247)
+++ trunk/gnue-samples/two-tier/forms/items.gfd 2007-01-09 20:54:39 UTC (rev 
9248)
@@ -1,21 +1,21 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
   GNU Enterprise Sample Application - Items
- 
+
   Copyright 2001-2007 Free Software Foundation
- 
+
   This file is part of GNU Enterprise
- 
+
   GNU Enterprise is free software; you can redistribute it
   and/or modify it under the terms of the GNU General Public
   License as published by the Free Software Foundation; either
   version 2, or (at your option) any later version.
- 
+
   GNU Enterprise is distributed in the hope that it will be
   useful, but WITHOUT ANY WARRANTY; without even the implied
   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
   PURPOSE. See the GNU General Public License for more details.
- 
+
   You should have received a copy of the GNU General Public
   License along with program; see the file COPYING. If not,
   write to the Free Software Foundation, Inc., 59 Temple Place
@@ -35,46 +35,41 @@
 
   <datasource name="dts_item" connection="sample" table="item" >
     <sortorder>
-      <sortfield name="sku" descending="False" ignorecase="True" />
+      <sortfield name="sku" descending="False" ignorecase="True"/>
     </sortorder>
   </datasource>
 
   <!-- #################################################################### -->
 
-  <datasource name="dts_invoice_item" connection="sample" table="invoice_item"
-    master="dts_item" masterlink="id" detaillink="sku" />
+  <!-- Joins can be used in the table name if the backend is an SQL backend.
+       Datasources like this one won't work with an appserver or a file based
+       backend. -->
+  <datasource name="dts_invoice_item" connection="sample"
+    table="invoice_item left outer join invoice on invoice.id = 
invoice_item.invoice left outer join customer on customer.id = invoice.customer"
+    master="dts_item" masterlink="id" detaillink="sku"
+    primarykey="invoice_item.id"/>
 
-  <!-- #################################################################### -->
-
-  <datasource name="dts_invoice" connection="sample" table="invoice"
-    master="dts_invoice_item" masterlink="invoice" detaillink="id" />
-
-  <!-- #################################################################### -->
-
-  <datasource name="dts_customer" connection="sample" table="customer"
-    master="dts_invoice" masterlink="customer" detaillink="id" />
-
   <!-- ==================================================================== -->
   <!-- Logic                                                                -->
   <!-- ==================================================================== -->
 
   <logic>
     <block name="blk_item" datasource="dts_item">
+      <!-- autoquery="Y" means that anything entered in this field will cause a
+           query to run on exactly this field. -->
       <field name="sku" field="sku" datatype="text" maxLength="16"
         case="upper" autoquery="Y"/>
       <field name="description" field="description" datatype="text"
-        maxLength="50" />
+        maxLength="50"/>
       <field name="price" field="price" datatype="number" length="11"
-        scale="2" />
-      <field name="text" field="text" datatype="text" maxLength="1000" />
-      <field name="prep" field="prep_time" datatype="time" />
-      <field name="picture" />
+        scale="2"/>
+      <field name="text" field="text" datatype="text" length="1000"/>
+      <field name="prep" field="prep_time" datatype="time"/>
+      <field name="picture"/>
 
-      <!--
-        Whenever a record is loaded from the backend, we generate an apropriate
-        URL for it's picture.  This URL will be stored in the unbound field
-        'picture'.
-        -->
+      <!-- Whenever a record is loaded from the backend, we generate an
+           apropriate URL for it's picture.  This URL will be stored in the
+           unbound field 'picture'. -->
       <trigger type="ON-RECORDLOADED">
         url = "./images/%s.jpg" % blk_item.sku.get()
         blk_item.picture.value = url
@@ -85,28 +80,16 @@
 
     <block name="blk_inv_item" datasource="dts_invoice_item"
       editable="N" deletable="N">
-      <field name="quantity" field="quantity" datatype="number" length="9"
-        scale="0" />
-      <field name="price" field="unit_price" datatype="number" length="9"
-        scale="2"/>
+      <field name="quantity" field="invoice_item.quantity" datatype="number"
+        length="9" scale="0"/>
+      <field name="price" field="invoice_item.unit_price" datatype="number"
+        length="9" scale="2"/>
+      <field name="id" field="invoice.id" datatype="number"
+        length="8" scale="0"/>
+      <field name="date" field="invoice.date" datatype="date"/>
+      <field name="code" field="customer.code" datatype="text" length="8"/>
+      <field name="name" field="customer.name" datatype="text" length="50"/>
     </block>
-
-    <!-- ################################################################## -->
-
-    <block name="blk_invoice" datasource="dts_invoice"
-      editable="N" deletable="N">
-      <field name="date" field="date" datatype="date" />
-      <field name="id" field="id" datatype="number" length="8" scale="0" />
-    </block>
-
-    <!-- ################################################################## -->
-
-    <block name="blk_customer" datasource="dts_customer"
-      editable="N" deletable="N">
-      <field name="code" field="code" datatype="text" />
-      <field name="name" field="name" datatype="text" />
-    </block>
-
   </logic>
 
   <!-- ==================================================================== -->
@@ -129,15 +112,14 @@
     <page name="pg_stats" caption="Invoice items">
       <grid name="grid_stats" block="blk_inv_item" rows="10">
         <gridline>
-          <entry field="code" block="blk_customer" label="Cust.Code" />
-          <entry field="name" block="blk_customer" label="Customer" />
-          <entry field="id" block="blk_invoice" label="Inv.Nr" />
-          <entry field="date" block="blk_invoice" label="Inv.Date" />
-          <entry field="quantity" block="blk_inv_item" label="Quantity" />
-          <entry field="price" block="blk_inv_item" label="Price" />
+          <entry field="code" block="blk_inv_item" label="Cust.Code"/>
+          <entry field="name" block="blk_inv_item" label="Customer"/>
+          <entry field="id" block="blk_inv_item" label="Inv.Nr"/>
+          <entry field="date" block="blk_inv_item" label="Inv.Date"/>
+          <entry field="quantity" block="blk_inv_item" label="Quantity"/>
+          <entry field="price" block="blk_inv_item" label="Price"/>
         </gridline>
       </grid>
     </page>
   </layout>
-
 </form>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]