Openedge Development: Progress 4GL Handbook Contents
Total Page:16
File Type:pdf, Size:1020Kb
OpenEdgeTM Development: Progress® 4GL Handbook John Sadd Expert Series © 2003 Progress Software Corporation. All rights reserved. Progress® software products are copyrighted and all rights are reserved by Progress Software Corporation. This manual is also copyrighted and all rights are reserved. This manual may not, in whole or in part, be copied, photocopied, translated, or reduced to any electronic medium or machine-readable form without prior consent, in writing, from Progress Software Corporation. The information in this manual is subject to change without notice, and Progress Software Corporation assumes no responsibility for any errors that may appear in this document. The references in this manual to specific platforms supported are subject to change. Allegrix, A [Stylized], ObjectStore, Progress, Powered by Progress, Progress Fast Track, Progress Profiles, Partners in Progress, Partners en Progress, Progress en Partners, Progress in Progress, P.I.P., Progress Results, ProVision, ProCare, ProtoSpeed, SmartBeans, SpeedScript, and WebSpeed are registered trademarks of Progress Software Corporation or one of its subsidiaries or affiliates in the U.S. and/or other countries. A Data Center of Your Very Own, Allegrix & Design, AppsAlive, AppServer, ASPen, ASP-in-a-Box, BusinessEdge, Business Empowerment, Empowerment Center, eXcelon, Fathom, Future Proof, IntelliStream, ObjectCache, OpenEdge, PeerDirect, POSSE, POSSENET, ProDataSet, Progress Business Empowerment, Progress Dynamics, Progress Empowerment Center, Progress Empowerment Program, Progress for Partners, Progress OpenEdge, Progress Software Developers Network, PSE Pro, PS Select, SectorAlliance, SmartBrowser, SmartComponent, SmartDataBrowser, SmartDataObjects, SmartDataView, SmartDialog, SmartFolder, SmartFrame, SmartObjects, SmartPanel, SmartQuery, SmartViewer, SmartWindow, Technical Empowerment, Trading Accelerator, WebClient, and Who Makes Progress are trademarks or service marks of Progress Software Corporation or one of its subsidiaries or affiliates in the U.S. and other countries. SonicMQ is a registered trademark of Sonic Software Corporation in the U.S. and other countries. Vermont Views is a registered trademark of Vermont Creative Software in the U.S. and other countries. Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. Any other trademarks and/or service marks contained herein are the property of their respective owners. This product includes Raster Imaging Technology copyrighted by Snowbound Software 1993-2000. Raster imaging technology by SnowboundSoftware.com This product includes software developed by the Apache Software Foundation (http://www.apache.org/). Copyright © 1999 The Apache Software Foundation. All rights reserved (Xalan XSLT Processor) and Copyright © 2000-2002 The Apache Software Foundation. All rights reserved (Jakarta-Oro). The names “Apache,” “Xerces,” “Jakarta-Oro,” “ANT,” and “Apache Software Foundation” must not be used to endorse or promote products derived from this software without prior written permission. Products derived from this software may not be called “Apache” or “Jakarta-Oro,” nor may “Apache” or “Jakarta-Oro” appear in their name, without prior written permission of the Apache Software Foundation. For written permission, please contact [email protected]. Software distributed on an “AS IS” basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License agreement that accompanies the product. Portions of this software are copyrighted by DataDirect Technologies, 1991-2002. This product includes software developed by Vermont Creative Software. Copyright © 1988-1991 by Vermont Creative Software. This product includes software developed by IBM and others. Copyright © 1999, International Business Machines Corporation and others. All rights reserved. This product includes code licensed from RSA Security, Inc. Some portions licensed from IBM are available at http://oss.software.ibm.com/icu4j/. This product includes the RSA Data Security, Inc. MD5 Message-Digest Algorithm. Copyright ©1991-2, RSA Data Security, Inc. Created 1991. All rights reserved. This product includes software developed by the World Wide Web Consortium. Copyright © 1994-2002 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University), http://www.w3.org/Consortium/Legal/. All rights reserved. This work is distributed under the W3C® Software License [http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231] in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. December 2003 Product Code: 4632 Item Number: 98885; R10.0A Acknowledgements I'd like to thank all my colleagues who have reviewed this book and given valuable comments to add clarity to the text and also to point outwhere I had missed important information. My thanks also go to the OpenEdge™ development, quality assurance, and documentation teams who have worked hard to provide me with invaluable assistance throughout the writing of this book. OpenEdge Development: Progress 4GL Handbook Contents Preface . Preface–1 1. Introducing the Progress 4GL. 1–1 About the sample database. 1–2 Getting started with the 4GL—the Progress snowplow . 1–3 In the beginning…FOR EACH CUSTOMER . 1–5 Starting your OpenEdge session. 1–6 Writing your first procedure . 1–10 Basic characteristics of the Progress 4GL . 1–13 The 4GL is procedural. 1–13 The 4GL is block-structured . 1–13 A 4GL procedure consists of statements . 1–14 The 4GL combines procedural, database, and user interface statements. 1–15 Saving your test procedure . 1–16 2. Using Basic 4GL Constructs . 2–1 Refining the data selection with a WHERE clause . 2–2 Comparison operators . 2–3 Using quotation marks. 2–4 Creating nested blocks to display related data . 2–4 Changing labels and formats . 2–8 Using program variables and data types . 2–9 Defining formats . 2–11 Other variable qualifiers. 2–12 Variable naming conventions . 2–13 Placement of variable definitions. 2–14 Contents Defining an IF-THEN-ELSE decision point . 2–15 Using the Progress Unknown value . 2–16 Using built-In 4GL functions . 2–17 Progress 4GL Functions . 2–20 Putting a calculation into your procedure . 2–24 Arithmetic expressions and operands . 2–24 Arithmetic built-in functions . 2–26 Using the Intelligent Edit Control and its shortcuts . 2–28 Getting to online help . 2–32 Saving and compiling your test procedure . 2–35 3. Running Progress 4GL Procedures . 3–1 Running a subprocedure . 3–2 Using the Propath . 3–3 Using external and internal procedures . 3–8 Writing internal procedures . 3–9 Assigning a value to a variable. 3–10 When to use internal and external procedures. 3–13 Adding comments to your procedure . 3–14 4. Introducing the OpenEdge AppBuilder. 4–1 Starting the AppBuilder . 4–2 Creating a new procedure and window . 4–4 Adding fields to your window . 4–5 Changing object names and titles . 4–7 Saving a procedure from the AppBuilder . 4–8 Running your procedure . 4–9 Using the Query Builder . 4–10 Adding a browse to your window . 4–13 Using property sheets . 4–16 Using the Section Editor . 4–18 Looking at preprocessor values in the Code Preview . 4–20 Adding buttons to your window . 4–24 Defining a CHOOSE trigger for your button . 4–25 Defining user interface events . 4–28 Adjusting the layout of the buttons . 4–31 vi Contents 5. Examining the Code the AppBuilder Generates . 5–1 Viewing the entire sample procedure code . 5–2 The Definitions section . 5–3 Window, button, browse, and frame definitions . 5–4 Creating the window . 5–8 Defining triggers . 5–11 Triggers as event-driven code. 5–12 Looking at the main block . 5–13 The internal procedures . 5–17 Contrasting procedural and event-driven programs . 5–17 Advantages of the AppBuilder file format . 5–20 Looking ahead . 5–22 Reusable components . 5–22 User interface independence . 5–23 Distributed applications . ..