/* getCustOrders.p */
DEFINE TEMP-TABLE ttCust NO-UNDO FIELD CustNum AS INTEGER FIELD Name AS CHARACTER INDEX CustNumIdx IS UNIQUE PRIMARY CustNum. DEFINE TEMP-TABLE ttOrder NO-UNDO FIELD OrderNum AS INTEGER FIELD CustNum AS INTEGER INDEX OrderNumIdx IS UNIQUE PRIMARY OrderNum INDEX CustOrdIdx IS UNIQUE CustNum OrderNum. DEFINE TEMP-TABLE ttOrderLine NO-UNDO FIELD OrderNum AS INTEGER FIELD LineNum AS INTEGER INDEX OrderLineIdx IS UNIQUE PRIMARY OrderNum LineNum. DEFINE DATASET dsCustOrd FOR ttCust, ttOrder, ttOrderLine DATA-RELATION CustOrdRel FOR ttCust, ttOrder RELATION-FIELDS (CustNum, CustNum) DATA-RELATION OrdLinesRel FOR ttOrder, ttOrderLine RELATION-FIELDS (OrderNum, OrderNum) NESTED. DEFINE INPUT PARAMETER iCustNum AS INTEGER. DEFINE OUTPUT PARAMETER DATASET FOR dsCustOrd. /* fill dataset and return to caller */ ... |
<!-- dataset definition --> <element name="dsCustOrd" prodata:proDataSet="true"> <complexType> <sequence> <element maxOccurs="unbounded" minOccurs="0" name="ttCust"> <complexType> <sequence> <element name="CustNum" nillable="true" type="xsd:int"/> <element name="Name" nillable="true" type="xsd:string"/> </sequence> </complexType> </element> <element maxOccurs="unbounded" minOccurs="0" name="ttOrder"> <complexType> <sequence> <element name="OrderNum" nillable="true" type="xsd:int"/> <element name="CustNum" nillable="true" type="xsd:int"/> <!-- nested data relation between ttOrder and ttOrderLine --> <element maxOccurs="unbounded" minOccurs="0" name="ttOrderLine"> <complexType> <sequence> <element name="OrderNum" nillable="true" type="xsd:int"/> <element name="LineNum" nillable="true" type="xsd:int"/> </sequence> </complexType> </element> </sequence> </complexType> </element> </sequence> </complexType> <unique name="CustNumIdx" prodata:primaryIndex="true"> <selector xpath="Sn:.//ttCust"/> <field xpath="Sn:CustNum"/> </unique> <unique name="OrderNumIdx" prodata:primaryIndex="true"> <selector xpath=".//Sn:ttOrder"/> <field xpath="Sn:OrderNum"/> </unique> <unique name="CustOrdIdx"> <selector xpath="Sn:.//ttOrder"/> <field xpath="Sn:CustNum"/> <field xpath="Sn:OrderNum"/> </unique> <unique name="OrderLineIdx" prodata:primaryIndex="true"> <selector xpath=".//Sn:ttOrderLine"/> <field xpath="Sn:OrderNum"/> <field xpath="Sn:LineNum"/> </unique> <!-- non-nested data relation between ttCust and ttOrder --> <keyref name="CustOrdRel" refer="Sn:CustNumIdx"> <selector xpath="Sn:.//ttOrder"/> <field xpath="Sn:CustNum"/> </keyref> <!-- nested data relation between ttOrder and ttOrderLine --> <keyref name="OrdLinesRel" prodata:nested="true" refer="Sn:OrderLineIdx"> <selector xpath="Sn:.//ttOrderLine"/> <field xpath="Sn:OrderNum"/> </keyref> </element> |
<!-- dataset definition --> <complexType name="dsCustOrdParam" prodata:proDataSet="true"> <sequence> <element maxOccurs="unbounded" minOccurs="0" name="ttCust"> <complexType> <sequence> <element name="CustNum" nillable="true" type="xsd:int"/> <element name="Name" nillable="true" type="xsd:string"/> </sequence> </complexType> </element> <element maxOccurs="unbounded" minOccurs="0" name="ttOrder"> <complexType> <sequence> <element name="OrderNum" nillable="true" type="xsd:int"/> <element name="CustNum" nillable="true" type="xsd:int"/> <!-- nested data relation between ttOrder and ttOrderLine --> <element maxOccurs="unbounded" minOccurs="0" name="ttOrderLine"> <complexType> <sequence> <element name="OrderNum" nillable="true" type="xsd:int"/> <element name="LineNum" nillable="true" type="xsd:int"/> </sequence> </complexType> </element> </sequence> </complexType> </element> </sequence> <annotation> <appinfo> <unique name="CustNumIdx" prodata:primaryIndex="true"> <selector xpath=".//Sn:ttCust"/> <field xpath="Sn:CustNum"/> </unique> <unique name="OrderNumIdx" prodata:primaryIndex="true"> <selector xpath=".//Sn:ttOrder"/> <field xpath="Sn:OrderNum"/> </unique> <unique name="CustOrdIdx"> <selector xpath=".//Sn:ttOrder"/> <field xpath="Sn:CustNum"/> <field xpath="Sn:OrderNum"/> </unique> <unique name="OrderLineIdx" prodata:primaryIndex="true"> <selector xpath=".//Sn:ttOrderLine"/> <field xpath="Sn:OrderNum"/> <field xpath="Sn:LineNum"/> </unique> <!-- non-nested data relation between ttCust and ttOrder --> <keyref name="CustOrdRel" refer="Sn:CustNumIdx"> <selector xpath=".//Sn:ttOrder"/> <field xpath="Sn:CustNum"/> </keyref> <!-- nested data relation between ttOrder and ttOrderLine --> <keyref name="OrdLinesRel" prodata:nested="true" refer="Sn:OrderLineIdx"> <selector xpath=".//Sn:ttOrderLine"/> <field xpath="Sn:OrderNum"/> <field xpath="Sn:LineNum"/> </keyref> </appinfo> </annotation> </complexType> |