Download presentation
Presentation is loading. Please wait.
Published byDavid Hoover Modified over 9 years ago
1
DEV-5: Using ProDataSets™ in OpenEdge ® 10 Cheryl LaBarge Product Readiness
2
© 2007 Progress Software Corporation 2 DEV-5: Using ProDataSets™ in OpenEdge® 10 Agenda Evolution of data access Reasons to use ProDataSets Sharing data easily with the outside world Where to go next ProDataSets
3
© 2007 Progress Software Corporation 3 DEV-5: Using ProDataSets™ in OpenEdge® 10 ProDataSet Evolution of Data Access.db Work File Temp- Tables.dbi Temp- Tables Host Centric Web SOA & Beyond Client Server Temp- Tables ProDataSet Temp- Tables XML.NET Flexibility Combining the best of the past to meet the demands of the future Java SDO
4
© 2007 Progress Software Corporation 4 DEV-5: Using ProDataSets™ in OpenEdge® 10 Agenda Evolution of data access Reasons to use ProDataSets Sharing data easily with the outside world Where to go next ProDataSets
5
© 2007 Progress Software Corporation 5 DEV-5: Using ProDataSets™ in OpenEdge® 10 Reasons to Use ProDataSets Strength of temporary tables Flexibility to group data for business needs Straight forward methods and events Data caching Batching Complex multi–level data structures as a single entity
6
© 2007 Progress Software Corporation 6 DEV-5: Using ProDataSets™ in OpenEdge® 10 The Strength of the Temporary Table Based on the familiar temporary table Outline view Color code text
7
© 2007 Progress Software Corporation 7 DEV-5: Using ProDataSets™ in OpenEdge® 10 Temporary Tables Available for Use in UI AppBuilder perspective uses temp-tables for building a browse
8
© 2007 Progress Software Corporation 8 DEV-5: Using ProDataSets™ in OpenEdge® 10 Reasons to Use ProDataSets Strength of temporary tables Flexibility to group data for business needs Straight forward methods and events Data caching Batching Complex multi–level data structures as a single entity
9
© 2007 Progress Software Corporation 9 DEV-5: Using ProDataSets™ in OpenEdge® 10 Flexibility to Group Data for Business Needs The DATA-RELATION (OrderLine) defines the relationship between parent-child tables The RELATION-FIELDS (OrderNum, OrderNum) define fields in parent and child to use for selection Defaults for –Populating –Navigating
10
© 2007 Progress Software Corporation 10 DEV-5: Using ProDataSets™ in OpenEdge® 10 Data-Sources Easy to Use The Data-Source is a separate object from the ProDataSet One for each temp-table buffer Can define database buffers or a query or both XML methods allow easy loading of data from external sources
11
© 2007 Progress Software Corporation 11 DEV-5: Using ProDataSets™ in OpenEdge® 10 Relating the ProDataSet Using relation fields to define foreign keys Related Order lines
12
© 2007 Progress Software Corporation 12 DEV-5: Using ProDataSets™ in OpenEdge® 10 Data-Sources Provide Data Flexibility Data-Source can flatten a triple join into a single table Related Order lines The Data-Source can be more complex
13
© 2007 Progress Software Corporation 13 DEV-5: Using ProDataSets™ in OpenEdge® 10 Ability to Modify the Query Because they are based on temp-tables it is easy to use familiar QUERY-PREPARE to select necessary records Top level ONLY! Child fills based on data source and relation
14
© 2007 Progress Software Corporation 14 DEV-5: Using ProDataSets™ in OpenEdge® 10 Reasons to Use ProDataSets Strength of temporary tables Flexibility to group data for business needs Straight forward methods and events Data caching Batching Complex multi–level data structures as a single entity
15
© 2007 Progress Software Corporation 15 DEV-5: Using ProDataSets™ in OpenEdge® 10 Filling a ProDataSet Populate the ProDataSet from the Data-Sources FILL on the DataSet Fills every table starting with top-level buffers FILL on a buffer Fills that table and its descendents FILL-MODE on each buffer NO-FILL – skip this table EMPTY – empty the table first APPEND – add more records to the table MERGE – add records & eliminate duplicates REPLACE – replace existing records Straight forward FILL method
16
© 2007 Progress Software Corporation 16 DEV-5: Using ProDataSets™ in OpenEdge® 10 Populating with Data-Relations When a DataSet is populated, OpenEdge retrieves children of the current parent ProDataSet Data-Relation ttOrder 6102/09/06 84102/09/06 144102/09/06 ttOLine 6100009 6200009 6300011 84100009 84200009 84300011 Order Data-Source OrderLine Data-Source Application Database Navigate.w
17
© 2007 Progress Software Corporation 17 DEV-5: Using ProDataSets™ in OpenEdge® 10 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
© 2007 Progress Software Corporation 18 DEV-5: Using ProDataSets™ in OpenEdge® 10 Setting Callback Events Advantage over.NET dataset is the buffer storing current record context (ttOrder)
19
© 2007 Progress Software Corporation 19 DEV-5: Using ProDataSets™ in OpenEdge® 10 Navigating 1.Browse functionality2.Query syntax 1 2 dsOrderWinUp.w
20
© 2007 Progress Software Corporation 20 DEV-5: Using ProDataSets™ in OpenEdge® 10 Updating Through the ProDataSet ProDataSet tables can 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 and error messages to the client Maps to.NET and Java support for update versions Defining a BEFORE-TABLE
21
© 2007 Progress Software Corporation 21 DEV-5: Using ProDataSets™ in OpenEdge® 10 Before-Image Table for a DataSet dsOrderWinUp.w - Original record Values for order # 6 Delete Lines 2, 4, & 5 Modify Line 1 to have 60 Add 60 Fishing Lures (Item 44) Add 30 Fishing Poles (Item 13)
22
© 2007 Progress Software Corporation 22 DEV-5: Using ProDataSets™ in OpenEdge® 10 Before-Image Table for a DataSet Select ROW-DELETED ROW-MODIFIED ROW-CREATED ProDataSet/dsCompareTables.w
23
© 2007 Progress Software Corporation 23 DEV-5: Using ProDataSets™ in OpenEdge® 10 Saving Changes to the Database 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
24
© 2007 Progress Software Corporation 24 DEV-5: Using ProDataSets™ in OpenEdge® 10 ProDataSet Demo…
25
© 2007 Progress Software Corporation 25 DEV-5: Using ProDataSets™ in OpenEdge® 10 Reasons to Use ProDataSets Strength of temporary tables Flexibility to group data for business needs Straight forward methods and events Data caching Batching Complex multi–level data structures as a single entity
26
© 2007 Progress Software Corporation 26 DEV-5: Using ProDataSets™ in OpenEdge® 10 Data Caching DATASET – static reference like TABLE DATASET-HANDLE – dynamic reference to the DataSet and its definition, like TABLE- HANDLE – passes a simple DataSet handle to a local procedure Note! By default the DATASET and DATASET- HANDLE parameters copy the ProDataSet contents (deep copy) Passing a ProDataSet as a Parameter
27
© 2007 Progress Software Corporation 27 DEV-5: Using ProDataSets™ in OpenEdge® 10 Passing a ProDataSet BY-REFERENCE: Local to a Single Session
28
© 2007 Progress Software Corporation 28 DEV-5: Using ProDataSets™ in OpenEdge® 10 Remote DataSet Parameter BY-REFERENCE ProDataSet Temp- Tables ProDataSet Temp- Tables Deep Copy BY-REFERENCE is ignored, always a deep copy
29
© 2007 Progress Software Corporation 29 DEV-5: Using ProDataSets™ in OpenEdge® 10 ProDataSet Illustration of BY-REFERENCE Local Call DEFINE DATASET dsRef… DEFINE DATASET dsOrder REFERENCE-ONLY. RUN FillWithWHERE IN hOrderMain (INPUT icWhere, OUTPUT DATASET dsRef BY- REFERENCE). PROCEDURE FillWithWhere: DEFINE INPUT icWhere AS CHARACTER NO-UNDO. DEFINE OUTPUT PARAMETER FOR DATASET dsOrder. dsOrder:FILL(). END PROCEDURE. dsOrder:FILL(). Always the caller’s instance used Called procedure instantiates a ProDataSet that is never used References are redirected for the duration of that procedure call only Please note example was coded without this option Order Olines Unused ProDataSet Order Olines
30
© 2007 Progress Software Corporation 30 DEV-5: Using ProDataSets™ in OpenEdge® 10 Options for Parameters Local Call: For Data Caching Define DATASET dsPrices REFERENCE- ONLY… Define DATASET dsRef… RUN fetchData IN hProc2. DISPLAY. PROCEDURE fetchData: dsRef:FILL(). PROCEDURE bindData: DEFINE OUTPUT PARAMETER FOR DATASET dsRef BIND. END PROCEDURE. ItemSelection.p PriceListDataCache.p RUN bindData IN hProc2 (OUTPUT DATASET dsPrices BIND) ProDataSet – or temp-table – on one side of the call is defined REFERENCE-ONLY Use the BIND option on both sides of a single procedure call No need to pass the ProDataSet again! Unused ProDataSet Pricelist ProDataSet Pricelist
31
© 2007 Progress Software Corporation 31 DEV-5: Using ProDataSets™ in OpenEdge® 10 Summary of BY-REFERENCE and BIND BY-REFERENCE To use the caller’s ProDataSet instance in the called procedure REFERENCE-ONLY For the unused instance BIND To identify called or caller procedure’s instance to use Useful for data caching and separation of data management from user interface
32
© 2007 Progress Software Corporation 32 DEV-5: Using ProDataSets™ in OpenEdge® 10 Reasons to Use ProDataSets Strength of temporary tables Flexibility to group data for business needs Straight forward methods and events Data caching Batching Complex multi–level data structures as a single entity
33
© 2007 Progress Software Corporation 33 DEV-5: Using ProDataSets™ in OpenEdge® 10 Batching in a Distributed Stateless Environment QUERY CustBrowse PROCEDURE offEnd: PROCEDURE fetchCustomers: RUN fetchWhere ON hAppServer (OUTPUT DATASET dsCustomer) Procedure fetchWhere: DATASET dsCustomer:FILL() Database AppServer BATCH-SIZE LAST-BATCH NEXT-ROWID RESTART-ROWID OFF-END event Client APPEND) dsCustomer eCustomer dsCustomer eCustomer
34
© 2007 Progress Software Corporation 34 DEV-5: Using ProDataSets™ in OpenEdge® 10 ProDataSet Events to Support Data Batching The goal is to make data retrieval with batching transparent OFF-END event for a ProDataSet query Occurs when a query goes off the end Occurs before Browse:OFF-END Occurs before Query:QUERY-OFF-END FIND-FAILED for a FIND on a buffer Use to respond to individual missing rows
35
© 2007 Progress Software Corporation 35 DEV-5: Using ProDataSets™ in OpenEdge® 10 Sample Code for Batching Set up an event handler for OFF-END QUERY CustBrowse:SET-CALLBACK(“OFF-END”, “OffEnd”). Define the event handler PROCEDURE OffEnd: DEFINE INPUT PARAMETER DATASET FOR dsCustomer. IF NOT BUFFER eCustomer:LAST-BATCH THEN DO: RUN fetchCustomers. RETURN NO-APPLY. /* Cancel OFF-END */ END. END PROCEDURE.
36
© 2007 Progress Software Corporation 36 DEV-5: Using ProDataSets™ in OpenEdge® 10 Requesting a Batch from the Server Make the request RUN fetchWhere ON hServer (INPUT “Customer”, INPUT iBatchSize, INPUT-OUTPUT rRestartRowid, INPUT cWhereString, OUTPUT DATASET dsCustomer APPEND). Handle the request for data on the server hCustBuffer:BATCH-SIZE = iBatchSize. hDataSource:RESTART-ROWID(1) = rRestartRowid. hCustQuery:QUERY-PREPARE(“FOR EACH Customer WHERE “ + cWhereString). DATASET dsCustomer:FILL(). IF hCustBuffer:LAST-BATCH = NO THEN rRestartRowid = hDataSource:NEXT-ROWID(1).
37
© 2007 Progress Software Corporation 37 DEV-5: Using ProDataSets™ in OpenEdge® 10 Agenda Evolution of data access Reasons to use ProDataSets Sharing data easily with the outside world Where to go next ProDataSets
38
© 2007 Progress Software Corporation 38 DEV-5: Using ProDataSets™ in OpenEdge® 10 Converting Between XML and ProDataSets Exporting the entire ProDataSet to XML WRITE-XML – creates XML stream from data WRITE-XMLSCHEMA – creates XML Schema information based on the data definition READ-XML – takes XML source and loads it into a ProDataSet –It can create the ProDataSet definition after a CREATE DATASET statement READ-XMLSCHEMA – creates or verifies XML Schema information
39
© 2007 Progress Software Corporation 39 DEV-5: Using ProDataSets™ in OpenEdge® 10 Ability to Add External Data Pulling in third party items from XML based documents
40
© 2007 Progress Software Corporation 40 DEV-5: Using ProDataSets™ in OpenEdge® 10 Agenda Evolution of data access Reasons to use ProDataSets Sharing data easily with the outside world Where to go next ProDataSets
41
© 2007 Progress Software Corporation 41 DEV-5: Using ProDataSets™ in OpenEdge® 10 Relevant Exchange Sessions DayTimeSessionTitle Wed.8:00 - 9:30 AM DEV-14Using ProDataSets and WebClient for Robust B2B Applications Wed.10:00 - 11:00 AM DEV-15Building a resilient Retail System using WebClient, SonicMQ, and ProDataSets Wed.10:00 - 11:00 AM DEV-16ABL Database Objects Updated Wed.3:30-5INT-12Mastering ProDataSets and Native XML Datatypes with Sonic ESB
42
© 2007 Progress Software Corporation 42 DEV-5: Using ProDataSets™ in OpenEdge® 10 For More Information, Go to… PSDN AutoEdge Application Application Architecture Made Simple Progress eLearning Community: Using ProDataSets Documentation: 10.1B ProDataSet Manual, by John Sadd
43
© 2007 Progress Software Corporation 43 DEV-5: Using ProDataSets™ in OpenEdge® 10 In Summary Leverages what you know Flexible and easy to use Allows applications to combine data more effectively to meet business needs
44
© 2007 Progress Software Corporation 44 DEV-5: Using ProDataSets™ in OpenEdge® 10 Questions?
45
© 2007 Progress Software Corporation 45 DEV-5: Using ProDataSets™ in OpenEdge® 10 Thank you for your time
46
© 2007 Progress Software Corporation 46 DEV-5: Using ProDataSets™ in OpenEdge® 10
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.