1 / 40

The ProDataSet in OpenEdge™ 10

The ProDataSet in OpenEdge™ 10. John Sadd Progress Fellow and OpenEdge Evangelist. Agenda. ProDataSet Overview Syntax Specifics and Demo ProDataSet Directions. The ProDataSet. Data-Source1. Database. Field Map CustNum Name Contact. Query… Q1 for Customer. CustomerTT. OrderTT.

swann
Download Presentation

The ProDataSet in OpenEdge™ 10

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The ProDataSet inOpenEdge™ 10 John SaddProgress Fellow and OpenEdge Evangelist

  2. Agenda • ProDataSet Overview • Syntax Specifics and Demo • ProDataSet Directions

  3. The ProDataSet Data-Source1 Database Field MapCustNum Name Contact Query…Q1 for Customer CustomerTT OrderTT Data-Source2 6 1 01/05/9336 1 01/19/9379 1 02/10/93 1 Lift Line Skiing 2 Urpon Frisbee 3 Hoops Croquet Field MapOrderNum CustNum OrderDate Query… Q2 for Order Order Event Logic Customer 1 53 01/01/93 2 81 01/04/93 3 66 01/04/93 Lift Line Skiing Urpon Frisbee Hoops Croquet Dataset:Before-fillBuffer:Before-fillBefore-row-fill Row-Add Row-Delete… ProDataSet Data-Relation1

  4. The Bigger Picture – Today and Tomorrow .NET User Interface Jonas Grumby OK 110 Desert Isle Path Cancel Minnow, HI 4GL C# • ProDataSets become a driving force in OpenEdge Applications OpenEdgeBusiness Logic OpenEdge.NET Interface Purchase Order Business Logic PurchaseOrderProxy PO ProDataSet HeaderData DetailData OtherData WebClient / HTML User Interface OpenEdge4GL Interface 4GL or WebSpeed Interface Jonas Grumby OK 110 Desert Isle Path Cancel Minnow, HI OpenEdgeWeb Services Interface

  5. ProDataSet to ADO.NET DataSet • ProDataSet is a Progress in-memory data store • ProDataSet maps directly to an ADO.NET DataSet: • Design a .NET interface in terms of .NET DataSets • Build business logic in Progress

  6. Agenda • Distributed Data Management in Version 9 • ProDataSet Overview • Syntax Specifics and Demo • Futures

  7. A ProDataSet is made of Temp-Tables • Define temp-tables in the usual way DEFINE TEMP-TABLE ttOrder /* fields from Order db table */ FIELD OrderTotal AS DECIMAL FIELD CustName LIKE Customer.Name FIELD RepName LIKE SalesRep.RepName. DEFINE TEMP-TABLE ttOrderLine… DEFINE TEMP-TABLE ttItem…

  8. Define the DataSet • Define the DataSet in terms of the temp-tables it combines DEFINE DATASET dsOrder FOR ttOrder, ttOline, ttItem DATA-RELATION OrderLine FOR ttOrder, ttOline RELATION-FIELDS (OrderNum, OrderNum) DATA-RELATION LineItem FOR ttOline, ttItem RELATION-FIELDS (ItemNum, ItemNum) REPOSITION.

  9. Populating with Data-Relations OrderTT 6 1 01/05/9336 1 01/19/9379 1 02/10/93 …DATA-RELATION OrderLine FOR ttOrder, ttOline RELATION-FIELDS (OrderNum, OrderNum)… • When a DataSet is populated, Progress retrieves children of the current parent ProDataSet Data-Relation OrderLineTT 6 1 000096 2 000096 3 00011 36 1 0000936 2 0000936 3 00011

  10. Navigating with Data-Relations OrderTT 6 1 01/05/9336 1 01/19/9379 1 02/10/93 …DATA-RELATION OrderLine FOR ttOrder, ttOline RELATION-FIELDS (OrderNum, OrderNum)… • When a DataSet is navigated, Progress filters on children of the current parent ProDataSet Data-Relation OrderLineTT 6 1 000096 2 000096 3 00011 36 1 0000936 2 0000936 3 00011

  11. Defining Data-Sources Order • You can define a Data-Source for each temp-table buffer in the DataSet • Each Data-Source can define database buffers or a query or both • Data-Source is separate from any DataSet ProDataSet Data-Source SrcOrder OrderTT Query…Q1 for Order Database OrderLineTT Data-Source SrcOline OrderLine 1 53 01/01/93 2 81 01/04/93 3 66 01/04/93 1 53 01/01/93 2 81 01/04/93 3 66 01/04/93 Query… Q2 for OrderLine

  12. Defining a Data-Source with a Query • Define a query for a top-level table • For example, which Order(s) to start with • Or to define a join between buffers DEFINE QUERY qOrder FOR Order, Customer, SalesRep. DEFINE DATA-SOURCE srcOrder FOR QUERY qOrder Order KEYS (OrderNum), Customer KEYS (CustNum), SalesRep KEYS (SalesRep). QUERY qOrder:QUERY-PREPARE ("FOR EACH Order WHERE Order.OrderNum = " + STRING(iOrderNum) +", FIRST Customer OF Order, FIRST SalesRep OF Order").

  13. Defining a Data-Source without a Query OrderTT 6 1 01/05/9336 1 01/19/9379 1 02/10/93 ProDataSet Data-Relation OrderLineTT 6 1 000096 2 000096 3 00011 • If there’s a Data-Relation, its fields can tell Progress how to construct a query …DATA-RELATION OrderLine FOR ttOrder, ttOline RELATION-FIELDS (OrderNum, OrderNum)… DEFINE DATA-SOURCE srcOline FOR OrderLine KEYS (OrderNum).

  14. Attaching Data-Sources ProDataSet Order OrderTT 6 1 01/05/9336 1 01/19/9379 1 02/10/93 • Data-Sources are defined separately from the DataSet • You can attach a particular Data-Source without changing the DataSet definition • Data-Sources do not travel with the DataSet Database Data-Source SrcOrder 1 53 01/01/93 2 81 01/04/93 3 66 01/04/93 Query…Q1 for Order

  15. ATTACH-DATA-SOURCE Method • Relates a Data-Source to a DataSet buffer • Optional arguments: • Field mapping for fields with different names • Except-list to skip unwanted fields, or • Include-list to include only certain fields BUFFER ttOrder:ATTACH-DATA-SOURCE (DATA-SOURCE srcOrder:HANDLE, "Customer.Name,CustName"). BUFFER ttOline:ATTACH-DATA-SOURCE (DATA-SOURCE srcOline:HANDLE). BUFFER ttItem:ATTACH-DATA-SOURCE (DATA-SOURCE srcItem:HANDLE).

  16. Populating a ProDataSet • Use the FILL method to populate the DataSet • FILL on the DataSet fills every table starting with top-level buffers • FILL on a buffer fills that table and its descendents • FILL-MODE • NO-FILL – skip this table • EMPTY – empty the table first • APPEND – add more records to the table • MERGE – add recs & eliminate dups • REPLACE – replace existing recs

  17. Event Callback Procedures • You can define event procedures for: • Before and After FILL of the ProDataSet • Before and After FILL of any temp-table buffer • Before and After FILL of any record • Use ProDataSet events to prepare queries, attach Data-Sources, etc. • Use Buffer events to manipulate the table • Use Record events to populate calculated fields • You can use these events when there is no Data-Source at all

  18. Record-level Event Procedure • Fills a calculated OrderTotal field hBuff:SET-CALLBACK-PROCEDURE ("AFTER-ROW-FILL","postRecordFill",THIS-PROCEDURE). PROCEDURE postRecordFill: DEFINE INPUT PARAMETER DATASET FOR dsOrder. hBuff = hDset:GET-BUFFER-HANDLE(“ttOrder”). FOR EACH OrderLine WHERE OrderLine.OrderNum = INTEGER(hBuff:BUFFER-FIELD("OrderNum"):BUFFER-VALUE): dTotal = dTotal + OrderLine.ExtendedPrice. END. hBuff:BUFFER-FIELD("OrderTotal"):BUFFER-VALUE = dTotal. END PROCEDURE.

  19. ProDataSet demo…

  20. Passing a ProDataSet as a Parameter • You can pass a DataSet parameter as: • DATASET – static reference like TABLE for temp-tables • DATASET-HANDLE – dynamic reference to the DataSet and its definition, like TABLE-HANDLE for a temp-table • HANDLE – passes a simple DataSet handle to a local procedure • Note! • Within a single session DataSet parameters can be passed BY-REFERENCE

  21. Local DataSet Parameter OrderTT ProDataSet 6 1 01/05/9336 1 01/19/9379 1 02/10/93 RUN OrderDset.p ON hSession (INPUT iOrderNum, OUTPUT DATASET dsOrder BY-REFERENCE). /* OrderDset.p -- Test proc for Order Dataset */ {dsOrderTT.i} {dsOrder.i} DEFINE INPUT PARAMETER iOrderNum AS INTEGER. DEFINE OUTPUT PARAMETER DATASET FOR dsOrder.

  22. Remote DataSet Parameter OrderTT OrderTT ProDataSet ProDataSet 6 1 01/05/9336 1 01/19/9379 1 02/10/93 6 1 01/05/9336 1 01/19/9379 1 02/10/93 AppServer RUN OrderDset.p ON hSession(INPUT iOrderNum, OUTPUT DATASET dsOrder BY-REFERENCE). /* OrderDset.p */ DEFINE OUTPUT PARAMETER DATASET FOR dsOrder. Client

  23. Dynamic ProDataSets • Every element of a ProDataSet can be dynamic • CREATE DATASET • ADD-BUFFER() • ADD-RELATION() • A Data-Source can also be dynamic: • CREATE DATA-SOURCE • And a DataSet can use dynamic temp-tables • CREATE TEMP-TABLE • Attributes and methods manipulate the DataSet through its handle

  24. Updating Through the ProDataSet • ProDataSet tables have a companion before-image temp-table to record updates (add/change/delete) • Used to pass changes to the server to be made in the Data-Source • Maps to .NET support for update versions

  25. Before-Image Table for a DataSet OrderTT 6 1 01/05/9336 1 01/19/9379 1 02/10/93 • Original values for every modified record • Initial values for every added record • Original values for every deleted record ProDataSet Data-Relation OrderLineTT 6 1 000096 2 000106 3 00011 6 4 00077 0 0 00000 A 6 2 00009 M 6 5 00022 D

  26. Saving Changes To The Database • Use ATTACH-DATA-SOURCE to reattach the DataSet to the database tables for it • SAVE-ROW-CHANGES method for saving a row to the database • Uses the before-table for optimistic locking • Allows full control in the event of a conflict • ERROR, ERROR-STRING, REJECTED, DATA-SOURCE-MODIFIED attributes

  27. ProDataSet update demo…

  28. Agenda • Distributed Data Management in Version 9 • ProDataSet Overview • Syntax Specifics and Demo • ProDataSet Directions

  29. Enhancements in OpenEdge 10.0B and 10.0B01 • COPY-DATASET method enhancements • Also COPY-TEMP-TABLE • Behavior changed to allow copies between non-identical tables and DataSets • GET-CHANGES and MERGE-CHANGES • include parents of modified rows • FILL-MODE “REPLACE” • Refreshes rows already in the tables • Slower than MERGE because it requires FINDing each row as it is added to the temp-table

  30. Enhancements in OpenEdge 10.0B and 10.0B01 -- continued • Additional events to support data retrieval transparency • OFF-END for a ProDataSet query • FIND-FAILED for a FIND on a buffer • Extended support for data batching • BATCH-SIZE attribute for a buffer • LAST-BATCH attribute signals end of data • NEXT-ROWID for repositioning a query • See white paper for examples: • psdn.progress.com/library/product_info/ oera/index.ssp

  31. Data batching demo…

  32. ProDataSet Features in OE10.1 • Direct to-or-from XML conversion • This supports ProDataSets as parameters to Web services • Mapping from ProDataSets to Java SDOs • REFERENCE-ONLY to use called procedure’s ProDataSet instance • Also parameter passing BY-REFERENCE for temp-tables

  33. New dynamic syntax in 10.1 • Combines a dynamic ProDataSet reference with static names • hDataSet:ttOrderLine.Price • Simplifies logic to pass dynamic reference for flexibility

  34. In Conclusion… • The ProDataSet is a key part of the future of 4GL applications • It is part of a focus on building complex data definitions and business logic in the 4GL • The ProDataSet is a standards-conformant object that will integrate with .NET and Web services as part of a global Service-Oriented Architecture

  35. Additional Resources • Expert Series book: Using ProDataSets • Now available through amazon.com • PSDN white paper on Using Advanced ProDataSet Language Features • Part of a series on implementing the OERA • Instructor-led course: Using ProDataSets • OpenEdge online documentation

  36. Questions?

  37. Thank you for your time!

More Related