OpenEdge Development: Progress 4GL Handbook


Table of ContentsPreviousNextIndex

Table of Contents

Preface

Introducing the Progress 4GL

About the sample database

Getting started with the 4GL—the Progress snowplow

In the beginning…FOR EACH CUSTOMER

Starting your OpenEdge session

Writing your first procedure

Basic characteristics of the Progress 4GL

The 4GL is procedural

The 4GL is block-structured

A 4GL procedure consists of statements

The 4GL combines procedural, database, and user interface statements

Saving your test procedure

Using Basic 4GL Constructs

Refining the data selection with a WHERE clause

Comparison operators

Using quotation marks

Creating nested blocks to display related data

Changing labels and formats

Using program variables and data types

Defining formats

Other variable qualifiers

Variable naming conventions

Placement of variable definitions

Defining an IF-THEN-ELSE decision point

Using the Progress Unknown value

Using built-In 4GL functions

Progress 4GL Functions

Putting a calculation into your procedure

Arithmetic expressions and operands

Arithmetic built-in functions

Using the Intelligent Edit Control and its shortcuts

Getting to online help

Saving and compiling your test procedure

Running Progress 4GL Procedures

Running a subprocedure

Using the Propath

Using external and internal procedures

Writing internal procedures

Assigning a value to a variable

When to use internal and external procedures

Adding comments to your procedure

Introducing the OpenEdge AppBuilder

Starting the AppBuilder

Creating a new procedure and window

Adding fields to your window

Changing object names and titles

Saving a procedure from the AppBuilder

Running your procedure

Using the Query Builder

Adding a browse to your window

Using property sheets

Using the Section Editor

Looking at preprocessor values in the Code Preview

Adding buttons to your window

Defining a CHOOSE trigger for your button

Defining user interface events

Adjusting the layout of the buttons

Examining the Code the AppBuilder Generates

Viewing the entire sample procedure code

The Definitions section

Window, button, browse, and frame definitions

Creating the window

Defining triggers

Triggers as event-driven code

Looking at the main block

The internal procedures

Contrasting procedural and event-driven programs

Advantages of the AppBuilder file format

Looking ahead

Reusable components

User interface independence

Distributed applications

Dynamic programming

Procedure Blocks and Data Access

Blocks and block properties

Procedure block scoping

Language statements that define blocks

DO blocks

FOR blocks

REPEAT blocks

Data access without looping – the FIND statement

Record Buffers and Record Scope

Record buffers

Record scope

Generating a procedure listing file

Adding procedures to the test window

Defining h-OrderCalcs.p to calculate totals

Writing the BinCheck procedure to check inventory

Displaying the new fields in the window

Defining Graphical Objects

Types of objects

Defining static objects

Using the VIEW-AS phrase for data representation objects

Defining objects that don’t represent data values

Using and setting object attributes

Changing attribute values

Common attribute values for visual objects

Invoking object methods

Instantiating and realizing objects

Instantiating objects in a container

Realizing and derealizing objects

Using object events

User interface events

Defining triggers

Applying events in your application

Using Graphical Objects in Your Interface

Using data representation objects

Modifying fill-in attributes in the Properties Window

Changing a fill-in field to an editor

Adding a toggle box to the window

Defining a slider

Objects that display a list of choices for a data value

Using a radio set to display a set of choices for a value

Using other types of objects

Using rectangles to organize objects

Using images to display pictures

Adding text to the window

Using menus

Menu bars

Defining a menu bar

Defining a menu bar for the sample window

Defining a pop-up menu

Character-mode considerations

Conclusion

Providing Help for OpenEdge Applications

Field-level online help

Status messages

ToolTips

Online help systems

The SYSTEM-HELP statement

Accessing online help from the menu bar

Calling online help with a help button

Accessing online help with the help key

Quitting help when exiting the application

Using Queries

Why you use queries in your application

Queries versus block-oriented data access

Using queries to share data between procedures

Using queries to populate a browse

Defining and using queries

OPEN and CLOSE QUERY statements

GET statements

Closing a query

Determining the current number of rows in a query

Identifying the current row in the query

Repositioning a query

Extending the sample window to use the queries

Summary

Defining and Using Temp-tables

Using temporary tables in your application

Progress work-tables

The temporary database for temp-tables

Defining a temp-table

Using a temp-table to summarize data

Using a temp-table as a parameter

Temp-table parameter syntax

Defining a procedure to return Order Lines

Using BUFFER-COPY to assign multiple fields

Using include files to duplicate code

Adding an Order Line browse to the Customer window

Summary

Using the Browse Object

Defining a query for a browse

Planning for the size of the result set

Defining a browse

Changing the test window for the OrderLine browse

Enabling columns in the browse

Defining a single- or multiple-select browse

Browse selection and query interaction

Using calculated columns

Sizing a browse and browse columns

Programming with the browse

Browse events

Manipulating rows in the browse

Manipulating the browse itself

Browse style options

Resizable browse objects

Resizing the browse

Moving the browse

Resizing the browse column

Moving the browse column

Changing the row height of the browse

Additional attributes

User manipulation events

Using browse objects in character interfaces

Character browse modes

Control keys

Functional differences from the Windows graphical browse

Conclusion

Advanced Use of Procedures in Progress

RETURN statement and RETURN-VALUE

Using persistent procedures

Running a procedure PERSISTENT

Using a persistent procedure as a run-time library

Useful procedure attributes and methods

Using a persistent procedure as shared code

Using a persistent procedure to duplicate code

Deleting persistent procedures

Examples: Communicating between persistent procedures

Shared and global objects in Progress procedures

Why you generally shouldn’t use shared objects

Global shared objects in Progress

Defining Functions and Building Super Procedures

User-defined functions

Defining a function

Making a forward declaration for a function

Using the AppBuilder to generate function definitions

Making run-time references with DYNAMIC-FUNCTION

Using super procedures in your application

Super procedure language syntax

Super procedure guidelines

Using session super procedures

Super procedure example

PUBLISH and SUBSCRIBE statements

Subscribing to an event

Publishing an event

Passing parameters

Canceling a subscription

PUBLISH/SUBSCRIBE example

Conclusion

Handling Data and Locking Records

Overview of data handling statements

Record locking in Progress

Record locking examples

Making sure you release record locks

Lock table resources

Optimistic and pessimistic locking strategies

Updating Your Database and Writing Triggers

Transactions in Progress

Transaction blocks

Building updates into an application

Defining database triggers

Database trigger guidelines

Database events

Trigger procedure headers

Accessing and defining triggers

Session triggers

General trigger considerations

Managing Transactions

Controlling the size of a transaction

Making a transaction larger

Making a transaction smaller

Transactions and trigger and procedure blocks

Checking whether a transaction is active

The NO-UNDO keyword on temp-tables and variables

Using the UNDO statement

Using the UNDO statement in the sample procedure

Subtransactions

Transaction mechanics

Using the ON phrase on a block header

Handling the ERROR condition

ENDKEY condition

STOP condition

QUIT condition

Summary

Using Dynamic Graphical Objects

Creating visual objects

Assigning object attributes

Assigning triggers to a dynamic object

Object handles

Static object handles

Managing dynamic objects

Deleting dynamic objects

Using widget pools

Using named widget pools

Using unnamed widget pools

Are widget pools static or dynamic objects?

Manipulating the objects in a window

Reading and writing object attributes

Identifying the columns of a browse

Using the CAN-QUERY and CAN-SET functions

Adding dynamic objects to a window

Using a buffer handle and buffer field handles

Populating a list at run time

Creating dynamic fields

Frame parenting

Object positioning

Object sizing

Label handling

Data handling

Data typing

Adding dynamic fields to the test window

Using multiple windows

Creating window families

Creating a dynamic browse

ADD-COLUMNS-FROM method

ADD-LIKE-COLUMN method

ADD-CALC-COLUMN method

Notes on dynamic browses and browse columns

Extending the sample procedure with a dynamic browse

Accessing the browse columns

Creating a dynamic menu

Creating a menu

Creating a submenu

Creating menu items

Navigating the hierarchy of menu handles

Adding a dynamic menu to the test window

Summary

Using Dynamic Queries and Buffers

Using dynamic queries and query handles

Query methods and attributes

SET-BUFFERS method

ADD-BUFFER method

NUM-BUFFERS attribute

GET-BUFFER-HANDLE method

NAME attribute

QUERY-PREPARE method

PREPARE-STRING attribute

QUERY-OPEN method

Using the QUOTER function to assemble a query

QUERY-CLOSE method

QUERY-OFF-END attribute

IS-OPEN attribute

Navigation methods

Reposition methods

INDEX-INFORMATION attribute

NUM-RESULTS and CURRENT-RESULT-ROW attributes

Cleaning up a dynamic query

Extending the sample window to filter dynamically

Defining a trigger block for multiple objects

Using the SELF handle to identify an object in a trigger

Using INDEX-INFORMATION and a MESSAGE with a yes/no answer

Using dynamic buffers and buffer handles

Buffer handle attributes

Buffer handle methods

Specifying the lock or wait option as a variable

Extending the test window to use a buffer handle

Cleaning up dynamic buffers

Special dynamic buffer considerations

Using BUFFER-FIELD objects

Creating and Using Dynamic Temp-tables and Browses

Creating and using dynamic temp-tables

Temp-table methods

Temp-table attributes

Temp-table buffer methods and attributes

Changing field attributes in a temp-table buffer

Cleaning up a dynamic temp-table

Extending the example to create and display records

Temp-table parameters

Using the TABLE form

Using the HANDLE form

Using the TABLE-HANDLE form

Creating and using dynamic browses

Adding columns to the browse

Extending the test procedure with a dynamic browse

Adding columns to a static browse

Query methods for use with browses

The dynamic CALL object

Building a comprehensive example

Creating a dynamic browse and customizing its display

Reading the database metaschema data

Populating a selection list dynamically

Creating a dynamic query

Creating a dialog box procedure

Making a call to an AppServer

Creating a dynamic temp-table

Using the SESSION handle to identify dynamic objects

Dynamic programming considerations

Progress Programming Best Practices

Writing efficient procedures

Using NO-UNDO variables and temp-tables

Grouping assignments with the ASSIGN statement

Using BUFFER-COPY and BUFFER-COMPARE

Block-related tips

The CASE statement

Using arrays instead of lists

Using FOR FIRST versus FIND

The ETIME function

Using the CAN-FIND function

Dynamic programming tips

Using indexes properly

Hiding screen contents when making changes

Defining efficient queries and FOR EACH statements

Copying temp-tables as parameters

Setting your Propath correctly

Database and AppServer-related issues

Configuring your session using startup options

Memory management in Progress

Cleaning up dynamically allocated memory

Using widget pools

Making the best use of dynamic objects

Avoiding stale handles

Deleting persistent procedures

Deleting temp-table copies

Other object types

Conclusion

Conclusion to the book


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095
Table of ContentsPreviousNextIndex