DEV-5: Using ProDataSets - PowerPoint PPT Presentation

About This Presentation
Title:

DEV-5: Using ProDataSets

Description:

Because they are based on temp-tables it is easy to use familiar QUERY-PREPARE ... SAVE-ROW-CHANGES method for saving a row to the database ... – PowerPoint PPT presentation

Number of Views:329
Avg rating:3.0/5.0
Slides: 47
Provided by: PSC77
Category:

less

Transcript and Presenter's Notes

Title: DEV-5: Using ProDataSets


1
DEV-5 Using ProDataSetsin OpenEdge 10
Cheryl LaBarge
Product Readiness
2
Agenda
ProDataSets
  • Evolution of data access
  • Reasons to use ProDataSets
  • Sharing data easily with the outside world
  • Where to go next

3
Evolution of Data Access
Combining the best of the past to meet the
demands of the future
SDO
ProDataSet
Temp-Tables
 
 
 
 
 
 
 
XML
Temp-Tables
 
 
 
 
 
 
 
ProDataSet
Temp-Tables
 
 
 
 
 
 
 
Flexibility
Temp-Tables
 
 
 
 
 
 
 
.NET
Temp-Tables
 
 
 
 
 
 
 
Temp-Tables
 
 
 
 
 
 
 
Java
Temp-Tables
 
 
 
 
 
 
 
Work File
 
 
 
 
 
 
 
.db
.dbi
Web SOA Beyond
Client Server
Host Centric
4
Agenda
ProDataSets
  • Evolution of data access
  • Reasons to use ProDataSets
  • Sharing data easily with the outside world
  • Where to go next

5
Reasons to Use ProDataSets
Complex multilevel data structures as a single
entity
  • Strength of temporary tables
  • Flexibility to group data for business needs
  • Straight forward methods and events
  • Data caching
  • Batching

6
The Strength of the Temporary Table
Based on the familiar temporary table
Color code text
Outline view
7
Temporary Tables Available for Use in UI
AppBuilder perspective uses temp-tables for
building a browse
8
Reasons to Use ProDataSets
Complex multilevel data structures as a single
entity
  • Strength of temporary tables
  • Flexibility to group data for business needs
  • Straight forward methods and events
  • Data caching
  • Batching

9
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
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
Relating the ProDataSet
Using relation fields to define foreign keys
Related Order lines
12
Data-Sources Provide Data Flexibility
The Data-Source can be more complex
  • Data-Source can flatten a triple join into a
    single table

Related Order lines
13
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
Reasons to Use ProDataSets
Complex multilevel data structures as a single
entity
  • Strength of temporary tables
  • Flexibility to group data for business needs
  • Straight forward methods and events
  • Data caching
  • Batching

15
Filling a ProDataSet
Straight forward FILL method
  • 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

16
Populating with Data-Relations
Navigate.w
  • When a DataSet is populated, OpenEdge retrieves
    children of the current parent

ProDataSet
Order Data-Source
Application Database
Data-Relation
ttOLine
6 1 000096 2 000096 3 00011
OrderLine Data-Source
84 1 0000984 2 0000984 3 00011
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
Setting Callback Events
Advantage over .NET dataset is the buffer storing
current record context (ttOrder)
19
Navigating
dsOrderWinUp.w
  1. Browse functionality
  1. Query syntax

20
Updating Through the ProDataSet
Defining a BEFORE-TABLE
  • 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

21
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
Before-Image Table for a DataSet
ProDataSet/dsCompareTables.w
  • Select

ROW-DELETED ROW-MODIFIED ROW-CREATED
23
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-MODIFIE
    D attributes

24
ProDataSet Demo
25
Reasons to Use ProDataSets
Complex multilevel data structures as a single
entity
  • Strength of temporary tables
  • Flexibility to group data for business needs
  • Straight forward methods and events
  • Data caching
  • Batching

26
Data Caching
Passing a ProDataSet as a Parameter
  • 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)

27
Passing a ProDataSet BY-REFERENCELocal to a
Single Session
28
Remote DataSet Parameter BY-REFERENCE
BY-REFERENCE is ignored, always a deep copy
AppServer
ProDataSet
ProDataSet
Deep Copy
Temp-Tables
 
 
 
 
 
 
 
Temp-Tables
 
 
 
 
 
 
 
Temp-Tables
 
 
 
 
 
 
 
Temp-Tables
 
 
 
 
 
 
 
Client
29
Illustration of BY-REFERENCE Local Call
Please note example was coded without this option
ProDataSet
Unused ProDataSet
Order
 
Order
 
Olines
 
 
 
DEFINE DATASET dsRef
DEFINE DATASET dsOrder REFERENCE-ONLY.
Olines
 
 
 
dsOrderFILL().
PROCEDURE FillWithWhere DEFINE INPUT icWhere AS
CHARACTER NO-UNDO. DEFINE OUTPUT PARAMETER FOR
DATASET dsOrder. dsOrderFILL(). END PROCEDURE.
RUN FillWithWHERE IN hOrderMain (INPUT icWhere,
OUTPUT DATASET dsRef BY-REFERENCE).
  • Always the callers instance used
  • Called procedure instantiates a ProDataSet that
    is never used
  • References are redirected for the duration of
    that procedure call only

30
Options for Parameters Local CallFor Data
Caching
PriceListDataCache.p
ProDataSet
ItemSelection.p
Unused ProDataSet
Pricelist







Pricelist






Define DATASET dsPrices REFERENCE-ONLY
Define DATASET dsRef
PROCEDURE bindData DEFINE OUTPUT PARAMETER FOR
DATASET dsRef BIND. END PROCEDURE.
RUN bindData IN hProc2 (OUTPUT DATASET dsPrices
BIND)
RUN fetchData IN hProc2. DISPLAY ltdsPrices
fieldsgt.
PROCEDURE fetchData dsRefFILL().
  • 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!

31
Summary of BY-REFERENCE and BIND
  • BY-REFERENCE
  • To use the callers ProDataSet instance in the
    called procedure
  • REFERENCE-ONLY
  • For the unused instance
  • BIND
  • To identify called or caller procedures instance
    to use
  • Useful for data caching and separation of data
    management from user interface

32
Reasons to Use ProDataSets
Complex multilevel data structures as a single
entity
  • Strength of temporary tables
  • Flexibility to group data for business needs
  • Straight forward methods and events
  • Data caching
  • Batching

33
Batching in a Distributed Stateless Environment
AppServer
Client
Database
dsCustomer
eCustomer




dsCustomer
eCustomer








BATCH-SIZE
QUERY CustBrowse
LAST-BATCH
OFF-END event
PROCEDURE offEnd
NEXT-ROWID
Procedure fetchWhere DATASET dsCustomerFILL()
PROCEDURE fetchCustomers RUN fetchWhere ON
hAppServer (OUTPUT DATASET dsCustomer)

RESTART-ROWID
APPEND)
34
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 BrowseOFF-END
  • Occurs before QueryQUERY-OFF-END
  • FIND-FAILED for a FIND on a buffer
  • Use to respond to individual missing rows

35
Sample Code for Batching
  • Set up an event handler for OFF-END

QUERY CustBrowseSET-CALLBACK(OFF-END,
OffEnd).
  • Define the event handler

PROCEDURE OffEnd DEFINE INPUT PARAMETER
DATASET FOR dsCustomer. IF NOT BUFFER
eCustomerLAST-BATCH THEN DO RUN
fetchCustomers. RETURN NO-APPLY. / Cancel
OFF-END / END. END PROCEDURE.
36
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

hCustBufferBATCH-SIZE iBatchSize.
hDataSourceRESTART-ROWID(1) rRestartRowid.
hCustQueryQUERY-PREPARE(FOR EACH Customer WHERE
cWhereString). DATASET dsCustomerFILL(). IF
hCustBufferLAST-BATCH NO THEN rRestartRowid
hDataSourceNEXT-ROWID(1).
37
Agenda
ProDataSets
  • Evolution of data access
  • Reasons to use ProDataSets
  • Sharing data easily with the outside world
  • Where to go next

38
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
Ability to Add External Data
Pulling in third party items from XML based
documents
40
Agenda
ProDataSets
  • Evolution of data access
  • Reasons to use ProDataSets
  • Sharing data easily with the outside world
  • Where to go next

41
Relevant Exchange Sessions
Day Time Session Title
Wed. 800 -930 AM DEV-14 Using ProDataSets and WebClient for Robust B2B Applications
Wed. 1000 -1100 AM DEV-15 Building a resilient Retail System using WebClient, SonicMQ, and ProDataSets
Wed. 1000 -1100 AM DEV-16 ABL Database Objects Updated
Wed. 330-5 INT-12 Mastering ProDataSets and Native XML Datatypes with Sonic ESB
42
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
In Summary
  • Leverages what you know
  • Flexible and easy to use
  • Allows applications to combine data more
    effectively to meet business needs

44
Questions?
45
Thank you foryour time
46
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com