Title: Migration
1Reach Your Technical Peak 2004
2OpenEdge 10 ProDataSets
3Agenda
- Introduction
- What came before
- The ProDataSet advantage
- Demo
- Whats behind the curtain
4Guiding Principles of OpenEdge 10
Applications are a collection of software
components that reflect the actual business
processes
They do not exist as an island.
Interoperability and integration are second nature
They are not bound by any one user interface
technology, methodology, or platform
5OpenEdge Reference Architecture
A Roadmap for Applying Technology
to Business Challenges
- Designed by Product Management and Engineering
- Implemented through Services
- Empowerment
- Education Consulting
- Referenced by Engineering for Product Strategy
Roadmap decisions
6Introducing the ProDataSet
The Business of Application Data
- We rarely work these elements as independent sets
of data - Relationships are often defined in business
logic in order to enforce business integrity - Service Orientation may require these elements
to be treated as one unit
Data Formats that Match Business Requirements
7Introducing the ProDataSet
The ProDataSet is a new 4GL object
- Extends core data objects
- (temp-tables, queries, buffers, etc.)
- Provides facilities to create and manage
multi-set data objects - Properties include specification of
Data-Relationships among the set members - Supports automatic filling of the set from the
source(s)
8The Bigger Picture
- ProDataSets become the 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
Schema- holder
ADM or other 4GL/Web Interface
Jonas Grumby
OK
110 Desert Isle Path
Cancel
Minnow, HI
RDBMS
OpenEdgeWeb Services Interface
9Agenda
- Introduction
- What came before
- The ProDataSet advantage
- Demo
- Whats behind the curtain
10What came before
Before the age of ProDataSets
- TempTables
- Introduced in V7
- TempTables as parameters, dynamic TempTables came
later - Dynamic Queries and Buffers
- Introduced in V9
- SDOs and SBOs
- External data sources
- Separate and non-equal
- XML, flat files, ODBC/other DataServer sources
11What came before
How to make it better?
- Provide language support for logical
relationships between temp-tables - Optimize performance when passing temp-tables
- Isolate data-related business logic
- Extend reusability
- Leverage Progress superior data access and
business logic in a changing business environment
12Agenda
- Introduction
- What came before
- The ProDataSet advantage
- Demo
- Whats behind the curtain
13The ProDataSet advantage
More intuitive by design
- Business objects more closely aligned to
application objects application design is less
constrained by data source design - A logical group of heterogenous sources can be
treated as a single data object - Introduces levels of indirection for future
flexibility as business requires - Provides robust default behaviors
14The ProDataSet advantage
Performance
- ProDataSet is a Progress in-memory data store
- Within a session, structure and contents can be
passed by reference for both static and dynamic
ProDataSets - Single handle passes ProDataSet definition,
buffers, and relationships all marshaled along
with the data.
15The ProDataSet advantage
Business logic integration
- Closer integration of data objects and related
business logic within an application - Supports event-related extensions at appropriate
points - Designed to operate effectively in a context-free
environment - Before-tables are built-in to capture changes
made on the client side
16ProDataSet to ADO.NET DataSet
- ProDataSet maps directly to an ADO.NET DataSet,
allowing you to - Design a .NET interface in terms of .NET DataSets
- while still harnessing the Power of Progress to
- Pass data back and forth to Progress AppServer
- Design ProDataSets in terms of Progress
- Build business logic in Progress to be invoked
from the ProDataSet
17The ProDataSet advantage
How to get it
- Built on existing language objects
- Default queries speed development
- Structures encourage separation of data
manipulation from the data sources - Simplifies data encapsulation in a distributed
environment
18Components of a ProDataSet
19Steps to Create a DataSet
Static DataSet
- Define Temp Tables
- Define DataSet
- Define top-level Query
- Define DataSources
- Prepare the top-level Query
- Attach DataSources to the DataSet
- FILL the DataSet
20A ProDataSet is made of Temp-Tables
- Define temp-tables in the usual way
DEFINE TEMP-TABLE ttOrder LIKE Order FIELD
OrderTotal AS DECIMAL FIELD CustName LIKE
Customer.Name FIELD RepName LIKE
SalesRep.RepName. DEFINE TEMP-TABLE ttOline LIKE
OrderLine. DEFINE TEMP-TABLE ttItem FIELD
ItemNum LIKE ITEM.ItemNum FIELD ItemName LIKE
ITEM.ItemName FIELD Price LIKE ITEM.Price
FIELD Weight LIKE ITEM.Weight FIELD OnHand
LIKE ITEM.OnHand FIELD OnOrder LIKE
ITEM.OnOrder.
21Define the DataSet
- Define the DataSet in terms of the temp-tables it
combines and their relationship to each other
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.
22Defining 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 ...
QUERY qOrderQUERY-PREPARE
23FILL the ProDataSet
DATASET dsOrderFILL().
24Round-Trip Scenario
Server-Side
Client-Side
UI
25Agenda
- Introduction
- What came before
- The ProDataSet advantage
- Demo
- Whats behind the curtain
26Data-Relations
- Data-Relations define the relationship between
parent-child tables - The Relation-Fields define fields in parent and
child to use for selection
DATA-RELATION OrderLine FOR ttOrder,
ttOline RELATION-FIELDS (OrderNum,
OrderNum)
- Relation-Fields are used to determine how to
populate the DataSet by default - Data-Relations also define default navigation of
the DataSet
27Data Relations
Demo sample code
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.
28Populating with Data-Relations
DATA-RELATION OrderLine FOR ttOrder,
ttOline RELATION-FIELDS (OrderNum,
OrderNum)
- When a DataSet is populated, Progress retrieves
children of the current parent
ProDataSet
OrderTT
79 1 02/10/93
Data-Relation
OrderLineTT
29Navigating with Data-Relations
DATA-RELATION OrderLine FOR ttOrder,
ttOline RELATION-FIELDS (OrderNum,
OrderNum)
- When a DataSet is navigated, Progress filters on
children of the current parent
ProDataSet
OrderTT
6 1 01/05/9336 1 01/19/9379 1 02/10/93
Data-Relation
OrderLineTT
- 6 1 00009
- 2 00009
- 6 3 00011
- 1 00009
- 36 2 00009
- 36 3 00011
30Defining Data-Sources
- 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
31Defining Data-Sources
Demo sample code
DEFINE DATA-SOURCE srcOrder FOR QUERY qOrder
Order KEYS (OrderNum), Customer KEYS (CustNum),
SalesRep KEYS (SalesRep). DEFINE DATA-SOURCE
srcOline FOR OrderLine. DEFINE DATA-SOURCE
srcItem FOR ITEM KEYS (ItemNum).
32Defining a Data-Source without a Query
- If theres 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).
ProDataSet
OrderTT
6 1 01/05/9336 1 01/19/9379 1 02/10/93
Data-Relation
OrderLineTT
6 1 000096 2 000096 3 00011
33Attaching Data-Sources
- Data-Sources are defined separately from the
ProDataSet - You can attach/detach any available Data-Source
independent of the ProDataSet definition - Data-Sources do not travel with the ProDataSet
Database
ProDataSet
Data-Source SrcOrder
OrderTT
1 53 01/01/93 2 81 01/04/93 3 66 01/04/93
6 1 01/05/9336 1 01/19/9379 1 02/10/93
Query Q1 for Order
34Attaching Data-Sources
Demo sample code
/ Attach datasources before fill / BUFFER
ttOrderATTACH-DATA-SOURCE(DATA-SOURCE
srcOrderHANDLE,
"Customer.Name,CustName"). BUFFER
ttOlineATTACH-DATA-SOURCE(DATA-SOURCE
srcOlineHANDLE). BUFFER ttItemATTACH-DATA-SOURC
E(DATA-SOURCE srcItemHANDLE).
/Detach datasources after fill / DO iBuff 1
TO DATASET dsOrderNUM-BUFFERS DATASET
dsOrderGET-BUFFER-HANDLE(iBuff)DETACH-DATA-SOURC
E(). END.
35Dynamic 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 lets you manipulate the
DataSet through its handle
36Dynamic ProDataSet
Static
DEFINE NEW SHARED DATASET
dataset-name FOR buffer-name , buffer-name
... DATA-RELATION data-rel-name FOR
data-rel-spec , DATA-RELATION data-rel-name
data-rel-spec ...
Dynamic
CREATE DATASET dataset-handle IN WIDGET-POOL
widget-pool-name LIKE other-dataset-name
other-dataset-handle DELETE OBJECT
dataset-handle.
37Dynamic ProDataSet
Demo sample code
CREATE DATASET phDataSet. DO iEntry 1 TO
NUM-ENTRIES(pcSources) CREATE TEMP-TABLE
hTable. hTableCREATE-LIKE(ENTRY(iEntry,
pcSources)). hTableTEMP-TABLE-PREPARE("tt
" ENTRY(iEntry, pcSources)).
phDataSetADD-BUFFER(hTableDEFAULT-BUFFER-HANDLE)
. END. . . .
38Populating 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 records and eliminate dups
39Audience Quiz What is the sample code statement
that populates the DataSet dsOrder?
hDSOrderFILL().
40Passing 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 - Within a session you can pass a DataSet
BY-REFERENCE to avoid the overhead of copying the
DataSet
41Passing DataSets as Parameters
Demo sample code
/ RUN OrderMain.p (INPUT iOrderNum, OUTPUT
DATASET dsOrder). / IF tAppServer THEN RUN
AppServerCode/ProDataSet/OrderMain.p ON SERVER
hAppServer (INPUT iOrderNum, OUTPUT
DATASET dsOrder). ELSE RUN
ProDataSet/OrderMain.p (INPUT
iOrderNum, OUTPUT DATASET dsOrder BY-REFERENCE).
42Event 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
43ProDataSet event procedure
Demo sample code
phDSOrderSET-CALLBACK-PROCEDURE
("BEFORE-FILL", "preDataSetFill", THIS-PROCEDURE).
PROCEDURE preDataSetFill DEFINE INPUT
PARAMETER DATASET hDset. hqOrderQUERY-PREPARE
(FOR EACH Order WHERE Order.OrderNum
STRING(piOrderNum) , FIRST
Customer OF Order, FIRST SalesRep OF Order). END
PROCEDURE. / preDataSetFill /
44Record-level event procedure
Demo sample code
hBuffSET-CALLBACK-PROCEDURE
("AFTER-ROW-FILL", "postRecordFill",
THIS-PROCEDURE).
- Fills a calculated OrderTotal field
PROCEDURE postRecordFill DEFINE INPUT PARAMETER
DATASET hDset. hBuff hDsetGET-BUFFER-HANDLE(
ttOrder). FOR EACH OrderLine WHERE
OrderLine.OrderNum
INTEGER(hBuffBUFFER-FIELD("OrderNum")BUFFER-VALU
E) dTotal dTotal
OrderLine.ExtendedPrice. END.
hBuffBUFFER-FIELD("OrderTotal")BUFFER-VALUE
dTotal. END PROCEDURE.
45Updating Through the ProDataSet
- ProDataSet and companion before-tables retain the
information needed to apply updates
(add/change/delete) - Used to pass changes to the server to be made in
the Data-Source via SAVE-ROW-CHANGES - Maps to .NET support for update versions
- There are update callback events as well when
temp-table rows are changed - Full support for optimistic locking
46Before-Image Table for a DataSet
- Original values for every modified record
- Initial values for every added record
- Original values for every deleted record
ProDataSet
OrderTT
6 1 01/05/9336 1 01/19/9379 1 02/10/93
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
47ProDataSet Futures
- Planned for release 10.0B
- Additional events to support data retrieval
transparency (OFF-END, FIND-FAILED) - BATCH-SIZE and LAST-BATCH attributes
- MERGE-DATASET method
- Planned for subsequent OE10 releases
- Standard Data Access and Business Entity
templates with DataSets for the OERA - Direct to-or-from XML conversion
48Additional Resources
- John Sadds whitepapers
- http//www.progress.com/progress/products/document
ation/docs/dataset/papern.pdf - for n 1 to 6
- Instructor-led course Using ProDataSets
- OpenEdge online documentation set
- http//www.progress.com/products/documentation/sta
rt_openedge10/index.ssp
49(No Transcript)