Python Data Analysis - 2E (2017)
Python Data Analysis - 2E (2017)
These materials and all Progress® software products are copyrighted and all rights are reserved by Progress Software Corporation. The
information in these materials is subject to change without notice, and Progress Software Corporation assumes no responsibility for any errors
that may appear therein. The references in these materials to specific platforms supported are subject to change.
Business Empowerment, Business Making Progress, Corticon, DataDirect (and design), DataDirect Cloud, DataDirect Connect, DataDirect
Connect64, DataDirect XML Converters, DataDirect XQuery, Empowerment Center, Fathom, Making Software Work Together, OpenEdge,
Powered by Progress, Progress, Progress Control Tower, Progress Business Empowerment, Progress Empowerment Center, Progress
Empowerment Program, Progress OpenEdge, Progress RPM, Progress Software Business Making Progress, Progress Software Developers
Network, Rollbase, RulesCloud, RulesWorld, SequeLink, SpeedScript, Stylus Studio, Technical Empowerment, and WebSpeed are
registered trademarks of Progress Software Corporation or one of its affiliates or subsidiaries in the U.S. and/or other countries. AccelEvent,
AppsAlive, AppServer, BusinessEdge, Progress Easyl, DataDirect Spy, DataDirect SupportLink, Easyl, Future Proof, High Performance
Integration, OpenAccess, Pacific, ProDataSet, Progress Arcade, Progress ESP Event Manager, Progress ESP Event Modeler, Progress
Event Engine, Progress Pacific, Progress Profiles, Progress Results, Progress RFID, Progress Responsive Process Management, Progress
Software, ProVision, PSE Pro, SectorAlliance, SmartBrowser, SmartComponent, SmartDataBrowser, SmartDataObjects, SmartDataView,
SmartDialog, SmartFolder, SmartFrame, SmartObjects, SmartPanel, SmartQuery, SmartViewer, SmartWindow, WebClient, and Who Makes
Progress are trademarks or service marks of Progress Software Corporation and/or its subsidiaries or affiliates in the U.S. and other countries.
Java is a registered trademark of Oracle and/or its affiliates. Any other marks contained herein may be trademarks of their respective owners.
Please refer to the Release Notes applicable to the particular Progress product release for any third-party acknowledgments required to be
provided in the documentation associated with the Progress product.
The Release Notes can be found in the OpenEdge installation directory and online at: https://community.progress.com/
technicalusers/w/openedgegeneral/1329.openedge-product-documentation-overview.aspx.
August 2014
For the latest documentation updates see OpenEdge Product Documentation on Progress Communities: (https://
community.progress.com/technicalusers/w/openedgegeneral/1329.openedge-product-documentation-
overview.aspx).
Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Preface–1
iv
Contents
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Index–1
v
Contents
Figures
Figure 1–1: Paper filing system compared to a database . . . . . . . . . . . . . . . . . . . . 1–3
Figure 1–2: Relationship between a database and its tables . . . . . . . . . . . . . . . . . . 1–4
Figure 1–3: Fields and records in the Customer table . . . . . . . . . . . . . . . . . . . . . . . 1–5
Figure 1–4: Structure of a field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1–5
Figure 1–5: Simple and compound indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1–6
Figure 1–6: Relationship between Customer and Order tables . . . . . . . . . . . . . . . . 1–7
Figure 1–7: One-to-one relationships . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1–8
Figure 1–8: One-to-many relationships . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1–9
Figure 1–9: Many-to-many relationships . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1–9
Figure 2–1: Results main window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2–6
Figure 3–1: Relationship type field default behavior . . . . . . . . . . . . . . . . . . . . . . . . 3–9
Figure 4–1: Browse view example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4–2
Figure 4–2: Browse view displaying one query frame . . . . . . . . . . . . . . . . . . . . . . . 4–4
Figure 4–3: Browse view displaying two frames . . . . . . . . . . . . . . . . . . . . . . . . . . . 4–5
Figure 4–4: Form view example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4–7
Figure 4–5: Query with one frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4–13
Figure 4–6: Query with two frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4–14
Figure 4–7: Sample on-screen report format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4–16
Figure 4–8: Data displayed using Print Preview . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4–17
Figure 4–9: Label view icon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4–24
Figure 4–10: Export view icon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4–30
Figure 4–11: Export query . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4–30
Figure 4–12: ASCII file generated by an Export query . . . . . . . . . . . . . . . . . . . . . . . . 4–31
Figure 5–1: Example of a partial relationship . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5–5
Figure 5–2: Query displaying ordered items by customer . . . . . . . . . . . . . . . . . . . . 5–7
Figure 5–3: Query displaying ordered items by order number and date . . . . . . . . . 5–8
Figure 5–4: Changing sort order example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5–9
Figure 6–1: Default query display for records from multiple tables . . . . . . . . . . . . . 6–3
Figure 6–2: Master and Detail sections in a query view . . . . . . . . . . . . . . . . . . . . . . 6–4
Figure 6–3: Calculated fields example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6–6
Figure 6–4: Percent of Total calculation example . . . . . . . . . . . . . . . . . . . . . . . . . . 6–9
Figure 6–5: Total-Paid field example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6–10
Figure 6–6: Counter field example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6–12
Figure 6–7: Stacked Array field example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6–13
Figure 6–8: Adding a Lookup field example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6–14
Figure 6–9: Expression example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6–23
Figure 6–10: Round Amount field example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6–26
Figure 6–11: Add Field - Date Function dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . 6–27
Figure 6–12: Subtotals - example one . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6–39
Figure 6–13: Subtotals - example two . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6–40
Figure 6–14: Sort order by Cust-num field - example one . . . . . . . . . . . . . . . . . . . . . 6–42
Figure 6–15: Sort order by Totals Only Summary - example two . . . . . . . . . . . . . . . 6–43
Figure 7–1: Format dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7–5
vi
Contents
vii
Contents
Tables
Table 2–1: Query views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2–2
Table 3–1: Query views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3–3
Table 3–2: Partial relationship sample query data . . . . . . . . . . . . . . . . . . . . . . . . . 3–9
Table 3–3: Complete relationship sample query data . . . . . . . . . . . . . . . . . . . . . . . 3–10
Table 3–4: Print Preview navigation buttons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3–15
Table 4–1: Browse view keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4–3
Table 4–2: Navigation buttons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4–8
Table 4–3: Rearranging fields in the Form view . . . . . . . . . . . . . . . . . . . . . . . . . . . 4–12
Table 4–4: Report variable functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4–19
Table 4–5: Custom Page attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4–22
Table 4–6: Custom label attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4–28
Table 4–7: Custom export attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4–34
Table 4–8: Code formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4–36
Table 6–1: Results data analysis techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6–2
Table 6–2: Calculated fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6–7
Table 6–3: String functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6–20
Table 6–4: Numeric functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6–24
Table 6–5: Date functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6–27
Table 6–6: Logical functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6–31
Table 7–1: Field properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7–3
Table 7–2: Character field properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7–6
Table 7–3: Date field properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7–7
Table 7–4: Decimal and integer field properties . . . . . . . . . . . . . . . . . . . . . . . . . . . 7–8
Table A–1: Query menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A–2
Table A–2: Table menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A–3
Table A–3: Field menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A–3
Table A–4: Data menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A–4
Table A–5: Options menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A–4
Table A–6: View menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A–5
Table A–7: Help menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A–6
Table B–1: Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B–2
viii
Preface
This Preface contains the following sections:
• Purpose
• Audience
• Organization
• Typographical conventions
• OpenEdge messages
Purpose
This guide introduces you to Progress Results®. Query/Results, more commonly referenced
throughout this guide as Results, is an interactive, menu-driven tool that lets you query, report,
and maintain information stored in Progress-supported databases.
Audience
This guide is an end-user manual that explains how to use the default Results application. If you
purchased Results through a third-party application vendor, the vendor might have modified
Results. These modifications might include adding or removing features, or even incorporating
Results into another application. If you have a modified Results application, your vendor might
modify the help system to reflect these changes or provide you with additional documentation.
Organization
Chapter 1, “Results Overview”
Briefly describes the benefits of using Results, then explains basic database concepts.
Explains how to start and stop Results and use the online help system.
Explains how to use Results to query information in a database, then print and save your
queries.
Explains how to use the browse, form report, label, and export query views to process and
analyze data.
Explains how to change or refine the set of information a query retrieves from a database.
Preface–2
Preface
Explains how to use calculated field, totals, and subtotals to analyze data.
Explains how to add and remove display fields and change display field properties.
For the latest documentation updates see the OpenEdge Product Documentation category on
PSDN http://www.psdn.com/library/kbcategory.jspa?categoryID=129.
Typographical conventions
This manual uses the following typographical conventions:
Convention Description
SMALL, BOLD Small, bold capital letters indicate OpenEdge™ key functions and
CAPITAL LETTERS generic keyboard keys; for example, GET and CTRL.
Preface–3
OpenEdge Reporting: Query/Results for Windows
Convention Description
KEY1 KEY2 A space between key names indicates a sequential key sequence:
you press and release the first key, then press another key. For
example, ESCAPE H.
Syntax:
... Ellipses indicate repetition: you can choose one or more of the
preceding items.
OpenEdge messages
OpenEdge displays several types of messages to inform you of routine and unusual occurrences:
• Compile messages inform you of errors found while OpenEdge is reading and analyzing
a procedure before running it; for example, if a procedure references a table name that is
not defined in the database.
• Startup messages inform you of unusual conditions detected while OpenEdge is getting
ready to execute; for example, if you entered an invalid startup parameter.
Preface–4
Preface
• Continues execution, subject to the error-processing actions that you specify or that are
assumed as part of the procedure. This is the most common action taken after execution
messages.
• Returns to the Progress Procedure Editor, so you can correct an error in a procedure. This
is the usual action taken after compiler messages.
• Halts processing of a procedure and returns immediately to the Progress Procedure Editor.
This does not happen often.
OpenEdge messages end with a message number in parentheses. In this example, the message
number is 200:
If you encounter an error that terminates OpenEdge, note the message number before restarting.
• Choose Help→ Recent Messages to display detailed descriptions of the most recent
OpenEdge message and all other messages returned in the current session.
• Choose Help→ Messages and then enter the message number to display a description of
a specific OpenEdge message.
• In the Progress Procedure Editor, press the help key (F2 or CTRL-W).
Preface–5
OpenEdge Reporting: Query/Results for Windows
OpenEdge includes ANTLR (Another Tool for Language Recognition) software Copyright ©
2003-2006, Terence Parr All rights reserved. Neither the name of the author nor the names of
its contributors may be used to endorse or promote products derived from this software without
specific prior written permission. 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.
OpenEdge includes Concurrent Java software Copyright 1994-2000 Sun Microsystems, Inc. All
Rights Reserved. -Neither the name of or trademarks of Sun may be used to endorse or promote
products including or derived from the Java Software technology without specific prior written
permission; and Redistributions of source or binary code must contain the above copyright
notice, this notice and the following disclaimers: This software is provided "AS IS," without a
warranty of any kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS
AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. AND
ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY
LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE
SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN MICROSYSTEMS, INC.
OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR
FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE SOFTWARE,
EVEN IF SUN MICROSYSTEMS, INC. HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
Preface–6
Preface
OpenEdge includes DataDirect Connect for ODBC and DataDirect Connect64 for ODBC
software, which include ICU software 1.8 and later - Copyright © 1995-2003 International
Business Machines Corporation and others All rights reserved. Permission is hereby granted,
free of charge, to any person obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so, provided that the above
copyright notice(s) and this permission notice appear in all copies of the Software and that both
the above copyright notice(s) and this permission notice appear in supporting documentation.
OpenEdge includes DataDirect Connect for ODBC and DataDirect Connect64 for ODBC
software, which include software developed by the OpenSSL Project for use in the OpenSSL
Toolkit (http:/www.openssl.org/). Copyright © 1998-2006 The OpenSSL Project. All rights
reserved. And Copyright © 1995-1998 Eric Young ([email protected]). All rights reserved.
OpenEdge includes DataDirect products for the Microsoft SQL Server database which contain
a licensed implementation of the Microsoft TDS Protocol.
OpenEdge includes software authored by David M. Gay. Copyright © 1991, 2000, 2001 by
Lucent Technologies (dtoa.c); Copyright © 1991, 1996 by Lucent Technologies (g_fmt.c); and
Copyright © 1991 by Lucent Technologies (rnd_prod.s). Permission to use, copy, modify, and
distribute this software for any purpose without fee is hereby granted, provided that this entire
notice is included in all copies of any software which is or includes a copy or modification of
this software and in all copies of the supporting documentation for such software. THIS
SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT MAKES ANY
REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
PURPOSE.
Preface–7
OpenEdge Reporting: Query/Results for Windows
Technologies All Rights Reserved (dmisc.c; gdtoa.h; gethex.c; gmisc.c; sum.c); Copyright ©
1998, 1999 by Lucent Technologies All Rights Reserved (gdtoa.c; misc.c; smisc.c; ulp.c);
Copyright © 1998-2000 by Lucent Technologies All Rights Reserved (gdtoaimp.h); Copyright
© 2000 by Lucent Technologies All Rights Reserved (hd_init.c). Full copies of these licenses
can be found in the installation directory, in the c:/OpenEdge/licenses folder. Permission to use,
copy, modify, and distribute this software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright notice appear in all copies and that both
that the copyright notice and this permission notice and warranty disclaimer appear in
supporting documentation, and that the name of Lucent or any of its entities not be used in
advertising or publicity pertaining to distribution of the software without specific, written prior
permission. LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
OF THIS SOFTWARE.
OpenEdge includes http package software developed by the World Wide Web Consortium.
Copyright © 1994-2002 World Wide Web Consortium, (Massachusetts Institute of
Technology, European Research Consortium for Informatics and Mathematics, Keio
University). 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.
OpenEdge includes ICU software 1.8 and later - Copyright © 1995-2003 International Business
Machines Corporation and others All rights reserved. Permission is hereby granted, free of
charge, to any person obtaining a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, provided that the above copyright notice(s)
and this permission notice appear in all copies of the Software and that both the above copyright
notice(s) and this permission notice appear in supporting documentation.
OpenEdge includes Infragistics NetAdvantage for .NET v2009 Vol 2 Copyright © 1996-2009
Infragistics, Inc. All rights reserved.
Preface–8
Preface
OpenEdge includes JSTL software Copyright 1994-2006 Sun Microsystems, Inc. All Rights
Reserved. 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.
OpenEdge includes OpenSSL software developed by the OpenSSL Project for use in the
OpenSSL Toolkit (http://www.openssl.org/). Copyright © 1998-2007 The OpenSSL
Project. All rights reserved. This product includes cryptographic software written by Eric
Young ([email protected]). This product includes software written by Tim Hudson
([email protected]). Copyright © 1995-1998 Eric Young ([email protected]) All rights
reserved. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to endorse
or promote products derived from this software without prior written permission. For written
permission, please contact [email protected]. Products derived from this software may
not be called "OpenSSL" nor may "OpenSSL" appear in their names without prior written
permission of the OpenSSL Project. 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.
OpenEdge includes Quartz Enterprise Job Scheduler software Copyright © 2001-2003 James
House. All rights reserved. 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. This product uses and includes within its distribution, software developed by the
Apache Software Foundation (http://www.apache.org/).
OpenEdge includes code licensed from RSA Security, Inc. Some portions licensed from IBM
are available at http://oss.software.ibm.com/icu4j/.
OpenEdge includes the RSA Data Security, Inc. MD5 Message-Digest Algorithm. Copyright
©1991-2, RSA Data Security, Inc. Created 1991. All rights reserved.
OpenEdge includes Sonic software, which includes software developed by Apache Software
Foundation (http://www.apache.org/). Copyright © 1999-2000 The Apache Software
Foundation. All rights reserved. The names “Ant”, “Axis”, “Xalan,” “FOP,” “The Jakarta
Project”, “Tomcat”, “Xerces” and/or “Apache Software Foundation” must not be used to
endorse or promote products derived from the Product without prior written permission. Any
product derived from the Product may not be called “Apache”, nor may “Apache” appear in
their name, without prior written permission. For written permission, please contact
[email protected].
Preface–9
OpenEdge Reporting: Query/Results for Windows
OpenEdge includes Sonic software, which includes software Copyright © 1999 CERN -
European Organization for Nuclear Research. Permission to use, copy, modify, distribute and
sell this software and its documentation for any purpose is hereby granted without fee, provided
that the above copyright notice appear in all copies and that both that copyright notice and this
permission notice appear in supporting documentation. CERN makes no representations about
the suitability of this software for any purpose. It is provided "as is" without expressed or
implied warranty.
OpenEdge includes Sonic software, which includes software developed by ExoLab Project
(http://www.exolab.org/). Copyright © 2000 Intalio Inc. All rights reserved. The names
“Castor” and/or “ExoLab” must not be used to endorse or promote products derived from the
Products without prior written permission. For written permission, please contact
[email protected]. Exolab, Castor and Intalio are trademarks of Intalio Inc.
OpenEdge includes Sonic software, which includes software developed by IBM. Copyright ©
1995-2003 International Business Machines Corporation and others. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or
sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
provided that the above copyright notice(s) and this permission notice appear in all copies of the
Software and that both the above copyright notice(s) and this permission notice appear in
supporting documentation. 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. Except as contained in this notice, the name of a copyright holder shall not be used in
advertising or otherwise to promote the sale, use or other dealings in this Software without prior
written authorization of the copyright holder.
OpenEdge includes Sonic software, which includes the JMX Technology from Sun
Microsystems, Inc. Use and Distribution is subject to the Sun Community Source License
available at http://sun.com/software/communitysource.
OpenEdge includes Sonic software, which includes software developed by the ModelObjects
Group (http://www.modelobjects.com). Copyright © 2000-2001 ModelObjects Group. All
rights reserved. The name “ModelObjects” 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 “ModelObjects”, nor may “ModelObjects” appear in their name,
without prior written permission. For written permission, please contact
[email protected].
Preface–10
Preface
OpenEdge includes Sonic software, which includes code licensed from Mort Bay Consulting
Pty. Ltd. The Jetty Package is Copyright © 1998 Mort Bay Consulting Pty. Ltd. (Australia) and
others.
OpenEdge includes Sonic software, which includes files that are subject to the Netscape Public
License Version 1.1 (the “License”); you may not use this file except in compliance with the
License. You may obtain a copy of the License at http://www.mozilla.org/NPL/. Software
distributed under the License is 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. The Original Code is Mozilla Communicator client
code, released March 31, 1998. The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are Copyright 1998-1999
Netscape Communications Corporation. All Rights Reserved.
OpenEdge includes Sonic software, which includes software developed by the University
Corporation for Advanced Internet Development http://www.ucaid.edu Internet2 Project.
Copyright © 2002 University Corporation for Advanced Internet Development, Inc. All rights
reserved. Neither the name of OpenSAML nor the names of its contributors, nor Internet2, nor
the University Corporation for Advanced Internet Development, Inc., nor UCAID may be used
to endorse or promote products derived from this software and products derived from this
software may not be called OpenSAML, Internet2, UCAID, or the University Corporation for
Advanced Internet Development, nor may OpenSAML appear in their name without prior
written permission of the University Corporation for Advanced Internet Development. For
written permission, please contact [email protected].
OpenEdge includes the UnixWare platform of Perl Runtime authored by Kiem-Phong Vo and
David Korn. Copyright © 1991, 1996 by AT&T Labs. Permission to use, copy, modify, and
distribute this software for any purpose without fee is hereby granted, provided that this entire
notice is included in all copies of any software which is or includes a copy or modification of
this software and in all copies of the supporting documentation for such software. THIS
SOFTWARE IS BEING PROVIDED “AS IS”, WITHOUT ANY EXPRESS OR IMPLIED
WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR AT&T LABS MAKE
ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
PURPOSE.
OpenEdge includes XML Tools, which includes versions 8.9 of the Saxon XSLT and XQuery
Processor from Saxonica Limited (http://www.saxonica.com/) which are available from
SourceForge (http://sourceforge.net/projects/saxon/). The Original Code of Saxon
Preface–11
OpenEdge Reporting: Query/Results for Windows
comprises all those components which are not explicitly attributed to other parties. The Initial
Developer of the Original Code is Michael Kay. Until February 2001 Michael Kay was an
employee of International Computers Limited (now part of Fujitsu Limited), and original code
developed during that time was released under this license by permission from International
Computers Limited. From February 2001 until February 2004 Michael Kay was an employee
of Software AG, and code developed during that time was released under this license by
permission from Software AG, acting as a "Contributor". Subsequent code has been developed
by Saxonica Limited, of which Michael Kay is a Director, again acting as a "Contributor". A
small number of modules, or enhancements to modules, have been developed by other
individuals (either written especially for Saxon, or incorporated into Saxon having initially been
released as part of another open source product). Such contributions are acknowledged
individually in comments attached to the relevant code modules. All Rights Reserved. The
contents of the Saxon files are subject to the Mozilla Public License Version 1.0 (the "License");
you may not use these files except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/MPL/ and a copy of the license can also be found in the
installation directory, in the c:/OpenEdge/licenses folder. Software distributed under the
License is 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.
OpenEdge includes XML Tools, which includes Xs3P v1.1.3. The contents of this file are
subject to the DSTC Public License (DPL) Version 1.1 (the "License"); you may not use this
file except in compliance with the License. A copy of the license can be found in the installation
directory, in the c:/OpenEdge/licenses folder. Software distributed under the License is
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. The Original Code is xs3p. The Initial Developer of the Original Code is DSTC.
Portions created by DSTC are Copyright © 2001, 2002 DSTC Pty Ltd. All rights reserved.
OpenEdge includes YAJL software Copyright 2007, Lloyd Hilaiel. Redistribution and use in
source and binary forms, with or without modification, are permitted provided that the
following conditions are met: 1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form
must reproduce the above copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the distribution. 3. Neither the name
of Lloyd Hilaiel nor the names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission. THIS SOFTWARE IS
PROVIDED BY THE AUTHOR ` ` AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
Preface–12
Preface
Preface–13
OpenEdge Reporting: Query/Results for Windows
Preface–14
1
Results Overview
This chapter provides a brief overview of Results, and introduces you to the basic database
concepts that are essential to understanding Results. This chapter presents:
• Results overview
• Database basics
• Indexes
• Table relationships
OpenEdge Reporting: Query/Results for Windows
Results overview
In today’s fast-paced business environment, the amount of information you need to store,
organize, and manage is growing daily. Progress Results works in conjunction with your
Progress-supported database to help you sort, maintain, and analyze information quickly and
efficiently. Results helps you deal effectively with information overload and puts your
information to work for you. You can use Results to update information stored in your database,
create reports, generate mailing labels, or even export information from your database to
common software applications, including spreadsheet and word processing packages.
Note: If you are already familiar with database concepts, you consider skimming this chapter
before proceeding to Chapter 2, “Results Basics.”
Database basics
A database is a collection of data organized in logically related tables that can be accessed or
retrieved. A table is a collection of logically related records organized into rows and columns.
One way to understand how a database works is to think of it as an electronic filing system
because is organizes data in the same manner as a paper filing system.
When setting up a paper filing system, you keep all related information about a subject in a
filing cabinet. The database equivalent to a filing cabinet is a table. Both a filing cabinet and a
table allow you to group related information in one location. For example, in a paper filing
system you might store information about customers in a filing cabinet called Customer. In a
database, you store all this information in a Customer table.
How do you organize related information within a filing cabinet? By placing it in folders. In a
database, a record functions as a folder. A record is a complete set of related information or
data. For example, within the Customer filing cabinet, you would find folders for each
customer. In the Customer table, you would find the records for each customer.
1–2
Results Overview
Customer
Folder Record
For example, if you are running a business called All Around Sports, you might have a sales and
inventory database that contains several tables for storing information about your customers, the
products they have ordered, and your overall product inventory.
1–3
OpenEdge Reporting: Query/Results for Windows
Tables
Customer
Database
Customer
information
Order
Orders
Inventory
A database table is similar to a paper table, but the terminology differs a little. A row in a
database table is called a record and a column is called a field.
1–4
Results Overview
Fields (Columns)
Data (Field)
This section of the Customer table contains four records, and each record contains a complete
set of information about one customer. In this example, each record contains a customer
number, name, and street. These items are called fields.
A field contains two elements: the name of the field and the data stored in the field. Note that
the name of the field is common to all the fields in the same column. However, the data
contained within a field varies from record to record. For example, the data in the field
Cust-Num ranges from 101 to 104. Figure 1–4 shows the structure of a field.
Record Field
The field name and the type of data the field stores is determined when the table is created. The
data can be entered as an initial value when the database is created or later when the database is
used.
1–5
OpenEdge Reporting: Query/Results for Windows
Indexes
The last component of a database is called an index. When you open the drawer of a filing
cabinet and thumb through the tabs on the folders, you are using a kind of index. What is on the
paper tab represents the information found in the folder. For example, you expect the tabs in the
Customer filing cabinet to contain the name of the customer whose information is in that folder.
Similarly, an electronic index is a component defined for a specific database table that serves as
the basis for faster searching, sorting, or otherwise processing the records in that table.
In a database, an index is a list that contains a value for each record in the table. When you create
an index, you choose the fields used to derive the index value for each record. For example, if
you choose the Name field as an index, Progress creates an index for the Customer table that
consists of a list of customer names, just like the list of tabs in the paper filing system.
A simple index is based on the value of one field, while a compound index is based on two or
more fields. Figure 1–5 shows an example of a simple and a compound index.
Simple index
02176 Records sorted
First Jan with this index
Last Abel 02176
Street 123 Main St
37771
City Grovewood
01130
State MA
Zip code 02176
Compound index
Abel, Jan Records sorted
First Jan with this index
Last Abel Abel, Jan
Street 123 Main St
Ball, Ed
City Grovewood
Ball, Gene
State MA
Zip code 02176
1–6
Results Overview
Table relationships
The most powerful advantage that a database has over a paper filing system is that it can process
data based on the relationship between database tables. The relationship is based on shared data.
As shown in Figure 1–6, the Customer record contains the customer number, name, and address
fields. The Order record contains the customer number, order number, delivery date, etc. The
Order table is related to the Customer table because they contain a common field: Customer No.
Relationship
With relationships between the Customer and Order tables established, you can perform
requests for information, called queries. For example, you can query the database to find:
• All the customers whose orders are promised before November 10, 2004.
• The number of outstanding orders for each sales region. (The number of unshipped orders
for each region.)
As you can see by the relationship between the Customer and Order tables, relationships
between tables are based on standard business practices. These relationships are determined
when the database is designed.
1–7
OpenEdge Reporting: Query/Results for Windows
Types of relationships
You can create three types of relationships among tables: one-to-one, one-to-many,
many-to-many. The following sections describe these relationships.
One-to-one relationship
A one-to-one relationship occurs when one record can relate to one and only one instance of a
record in another table. For example, a business might decide to assign one office to exactly one
employee. Thus, one employee can have only one office. The same business might also decide
that a department can have only one manager. Thus, one manager can manage only one
department. Figure 1–7 illustrates this relationship.
Office Employee
Department Manager
1–8
Results Overview
One-to-many relationship
A one-to-many relationship occurs when one record can relate to multiple records in another
table. For example, one customer can place many orders, one student can take many courses,
and a sales representative can have many customer accounts. Figure 1–8 illustrates this
relationship.
Customer Order
Student Course
Many-to-many relationship
A many-to-many relationship occurs when multiple records can relate to multiple records in
another table. Likewise, those related records have many records in the first table. For example,
an order can contain many items, and an item can appear in many different orders; an employee
can work on many projects, and a project can have many employees working on it. Figure 1–9
illustrates this relationship.
Order Item
Employee Project
1–9
OpenEdge Reporting: Query/Results for Windows
1–10
2
Results Basics
This chapter explains the basics of what Results is and how it helps you maintain and analyze
information stored in your Progress-supported databases. Specifically, this chapter presents:
• Starting Results
• Exiting Results
OpenEdge Reporting: Query/Results for Windows
This guide describes how to use the Results application that PSC ships. If you have a modified
Results application, your vendor might modify or provide you with additional documentation.
View Purpose
Form Allows you to view, update, add, and delete individual records in
the database.
2–2
Results Basics
Results is flexible. Instead of presenting you with a predetermined set of queries, Results lets
you define and save queries that suit your particular needs. You can query all the records in a
particular table or you can query any number of fields in one or more related tables. If, for
example, your database contains Customer and Order tables and these tables are related, you
can instruct Results to find all the orders for each customer in the database.
Results provides you with a filter to refine the contents of your queries. For example, you can
use a filter to refine the previous query to find all the orders for each customer in Massachusetts.
Starting Results
How you start Results depends on whether your application was modified by a third-party
vendor. If your application was
• Not modified, you will most likely start Results from the ADE Desktop.
• Modified, you will most likely start it from within a program group or from within another
application.
The following sections describe how to start Results from a program group and from the ADE
Desktop. If your Results application is contained within another application or you are not sure
how to start Results, see your system administrator.
2–3
OpenEdge Reporting: Query/Results for Windows
2. If you are starting Results for the first time, a dialog box prompts you to create the .qc7
file. Choose Yes.
The Progress Results window appears. If your Results application was modified, you
might see additional startup screens before the Results main window appears.
Note: The query directory (.qc7) file contains descriptions to the filenames that Results
generates.
Note: Depending on how the Results application is configured, the appearance of the
OpenEdge Desktop and Results icons might differ from their appearance in these
instructions.
Note: The specific OpenEdge product icons that display can vary, depending on the
OpenEdge products installed at your site. The OpenEdge Desktop that appears in
this step only displays some of the available OpenEdge products that can
potentially appear on the OpenEdge Desktop.
2–4
Results Basics
3. If you’re starting Results for the first time, a dialog box prompts you to create the .qc7
file. Choose Yes.
4. If you are not connected to a database, the following dialog box appears:
After you connect to a database, the OpenEdge Results window appears. Note that if your
Results application was modified, you might see additional startup screens before the
Results window appears.
Note: The query directory (.qc7) file contains descriptions to the filenames that Results
generates.
2–5
OpenEdge Reporting: Query/Results for Windows
Menu bar
Refine the
Tool bar contents of
your queries
Status bar
• Menu bar — Lets you access the menu options you use to run Results. See Appendix A,
“Results Menus,” for a description of each menu.
• Tool bar — Provides quick access to the most commonly used Results menu options.
• Status bar — Contains informational messages about the current status of Results.
2–6
Results Basics
Exiting Results
The following section describes how to exit Results.
To exit Results:
If you created or modified the query and did not save it, a dialog box prompts you to save
your query.
2. Choose Yes to save the query or No to close the query without saving it.
If you are saving the query for the first time, the Save As dialog box appears.
Be sure to pick a description that reflects the type of query you created. For example, you
might type Customer for a query that accesses all the fields in the Customer table.
2–7
OpenEdge Reporting: Query/Results for Windows
2–8
3
Query Basics
This chapter explains the basics of creating and using queries. Specifically, this chapter
presents:
• Creating a query
• Saving a query
• Closing a query
• Printing queries
• Deleting a query
OpenEdge Reporting: Query/Results for Windows
Once you have located the data you need through the use of a query, you can use a variety of
sorting and filtering features to fine time and analyze the data. For example, to send catalogs to
your current customers only, you might create a query to locate the names and addresses of all
your customers who ordered merchandise in the last year. Then you can use the query to
generate mailing labels, create printed reports, update the information stored in the database,
and even create a data file to export the data to another application.
The remaining sections of this chapter provide procedural detail to create and use queries.
Creating a query
This section presents:
Note: The instructions in this guide are based on the demonstration database, the sports
database, that is shipped with the Results application. If you have access to this sample
database, you can use it while you learn how to use Results.
1. Select the database tables to be included in the query. When you create a query, you select
the tables that contain the information you want Results to retrieve.
2. Select the view you want to use to process the information retrieved by the query. A view
is an on-screen display of only part of the information in a database, as specified in a query.
A view can display data from one or more tables or from other views.
3–2
Query Basics
View Purpose
Browse Lists the tables in all connected databases from which you
can add or remove to build a query. This view is the initial,
basic view for all other views described in this table derive
data.
When you create a query, Results retrieves all the fields in each table you include in the
query. However, you might want to limit the number of display fields, which are the
fields that you select to appear in the view, whether on-screen or printed. For example, if
you create a query that accesses the Customer table, you might want to view only those
fields that contain address information. Limiting the display fields does not alter the
contents of the query; it simply limits the number of fields you view.
Once you create the initial query, you can modify its contents, select a new query view, or select
different display fields.
3–3
OpenEdge Reporting: Query/Results for Windows
To create a query:
Note: The steps for selecting the display fields do not apply to the Label view. See Chapter 4,
“Using Query Views,” for instructions on creating queries for the Label view.
1. Choose Query→ New and a view for the query. The Add/Remove Tables dialog box
appears:
The Available Tables selection list shows the tables that comprise the database that you
are connected to. If you are connected to more than one database, Results indicates the
database in which each table resides.
3–4
Query Basics
2. Select a table from the Available Tables selection list, then choose Add. The table
appears in the Selected Tables selection list. The Available Tables selection list now
displays only tables that have a relationship with the table you selected:
After you add tables, the Selected Tables selection list displays the relationships, or joins,
among the tables in the query. For example, if you select the Customer, Order, and
Order-Line tables, the Selected Tables selection list appears as follows:
3–5
OpenEdge Reporting: Query/Results for Windows
4. When you are done adding tables, choose OK. The Add/Remove Fields dialog box
appears:
The Available Fields selection list displays all the fields in the tables you selected. If you
are connected to more than one database, Results indicates the database where each field
in the list resides.
5. Select one or more fields from the Available Fields selection list, then choose Add:
To select multiple fields, press CTRL and click individual fields, or press SHIFT and drag
the mouse to select a range of fields. The fields are displayed in the Selected Fields
selection list in the order in which they will be displayed in the view (from left to right).
3–6
Query Basics
6. To reorder the display fields, select a field and choose Move Up or Move Down. Repeat
this process until the fields are listed in the order in which you want them to appear in the
view.
The appearance of the query depends on the type of view you chose in Step 1. The following
query illustrates the Browse view. See Chapter 4, “Using Query Views,” for more information
about changing and using query views:
Criteria for
selecting
records
Tables
Display
fields
Records
The status bar identifies the query view you are using and the database to which you are
connected. If you are connected to more than one database, the status bar lists the first database
to which you connected.
Each record in the view contains the information from the display fields you selected for the
query. In this example, the records are composite records because they contain fields from more
than one table. The data is displayed from left to right in the order you specified when you
created the query.
3–7
OpenEdge Reporting: Query/Results for Windows
The customer Lift Line Skiing appears several times because of the type of relationships
between the tables. Each customer can have one or more orders, thus the relationship between
the Customer and Order tables is a one-to-many relationship. Each order can have several line
items, so the Order and Order-Line tables also have a one-to-many relationship. Results displays
a composite record for each line item a customer orders.
• Sort order — Uses the primary index in the first table you included in the query to
determine the order in which Results retrieves records from the tables.
• Relationship types — Displays only those records that contain information in both tables.
When you create a query that contains more than one table, Results uses the primary index for
the first table you included in the query to determine the order in which Results retrieves and
displays the records. See Chapter 1, “Results Overview,” for more information about indexes.
You can change the order in which records are sorted by selecting one or more fields to control
the sort order for the query. For more information, see Chapter 5, “Changing the Query
Selection Criteria.”
3–8
Query Basics
When you create a query that specifies a field that is contained in more than one table, by default
Results retrieves only the records that contain data in the related fields.
2 Urpon Frisbee 21 4
4 Go Fishing Ltd. 94 2
6 Fanatical Athletes
In Figure 3–1, notice that the Order table doesn’t contain any orders for Customer 5. Thus, a
query to display the orders for each customer does not display a record for customer. This type
of a relationship is called a partial relationship, or inner join.
The sample query identified in Table 3–2 illustrates the results of a partial relationship between
the Customer and Order tables.
2 Urpon Frisbee 94
4 Go Fishing Ltd. 21
3–9
OpenEdge Reporting: Query/Results for Windows
If you want to display all the records in the Customer table whether or not the Order table
contains a related record, you can change the type of relationship between the tables to a
complete relationship, or an outer join. The sample query identified in Table 3–3 illustrates the
results of a complete relationship between the Customer and Order tables.
2 Urpon Frisbee 94
4 Go Fishing Ltd. 21
For details on how to change table relationships in multi-table queries, see Chapter 5,
“Changing the Query Selection Criteria.”
3–10
Query Basics
Saving a query
Once you create a query, you can save and reuse the query whenever you want to access the
same information in your database.
To save a query:
The description can consist of up to 48 alphanumeric characters and spaces. You’ll use the
query description to locate and open queries, so pick a description that reflects the type of
query you create. For example, you might type Customer Orders for a query that
accesses all the orders for each customer in the Customer table.
Note: Results lets you use descriptions to locate and access query files, so you are not
limited to eight-character filenames. However, Results automatically generates
filenames for these files so that your computer can store and access them properly.
The query directory (.qd7) file contains a directory that maps the descriptions you
provide with the actual filenames Results generates. See the OpenEdge Reporting:
Query/Results Administration and Development for more information about the
query directory.
3. Choose OK.
Once you have saved a query, you can use the Save As command to save the query without
changing its description.
3–11
OpenEdge Reporting: Query/Results for Windows
Closing a query
You will generally want to close a query without exiting Results.
If you created or modified the query and did not save it, a dialog box prompts you to save.
2. Choose OK to save the query and close it, or No to close the query without saving it.
If you are saving the query for the first time, the Save As dialog box appears.
1. From the Results main window, choose Query→ Open. The Open dialog box appears.
3–12
Query Basics
3. By default, this dialog box lists all the queries for databases to which you are currently
connected. Although you cannot open queries for databases to which you are not currently
connected, you can list them by selecting the Show Queries on Disconnected Databases
toggle box.
Printing queries
You can print the contents of your queries and perform a print preview from the Report, Labels,
and Export query views.
To print a query:
2. Select the print settings you want to use, then choose OK.
3–13
OpenEdge Reporting: Query/Results for Windows
To use Print Preview, choose Query→ Print Preview. The query appears in a Print Preview
window:
Print button
Navigation
buttons
Close Button
Help Button
You can use several techniques to scan through records in Print Preview, including the
horizontal and vertical scroll bars, the navigation buttons, and PAGE UP and PAGE DOWN. The
following sections describe these methods.
Scroll bars
Use the vertical scroll bar to scan up and down through records on the current page. Use the
horizontal scroll bar to scroll left and right to view information that is wider than the window.
3–14
Query Basics
Navigation buttons
Table 3–4 identifies the navigation buttons you can use to change the current page displayed in
the print preview.
Button Description
Keyboard
Before you can use the keyboard to navigate in Print Preview, click anywhere inside the
preview to give it focus.
• Page down — Scrolls down through the current page one screen at a time.
3–15
OpenEdge Reporting: Query/Results for Windows
Deleting a query
Periodically, you might want to delete a query that is of limited or no use.
To select multiple queries, press CTRL and click individual queries, or press SHIFT and
drag the mouse to select a range of queries:
3. By default, this dialog box lists all the queries for databases that you are currently
connected to. To list additional queries for databases that you are not currently connected
to, activate the Show Queries on the Disconnected Databases toggle box.
3–16
4
Using Query Views
Results provides query views that process and analyze data. This chapter presents:
• Browse view
• Form view
• Report view
• Label view
• Export view
OpenEdge Reporting: Query/Results for Windows
When you switch between views, Results maintains both the contents of the query and the
display fields you selected, so none of your data is lost. However, the Labels view allows you
to select an additional set of display fields specifically for creating labels. In this case, Results
maintains two lists of display fields: the list you select for creating labels and the list you use
for the remaining query views. Results automatically toggles between the two lists depending
on the view you choose. See the “Label view” section on page 4–24 for more information about
switching to the Label view.
Browse view
A browse is an onscreen view that displays records in a tabular format similar to a spreadsheet.
You can use a browse view to scan through large numbers of records quickly. Figure 4–1 shows
an example of a browse.
Scroll
bar
Naviga-
tion
buttons
4–2
Using Query Views
The query in the browse presented in Figure 4–1uses a relationship among the Customer, Order,
and Order-Line tables to list the items each customer ordered. Each composite record displays
the Cust-Num and Name fields from the Customer table; the Order-num field from the Order
table, and the Item-num and Extended-Price fields from the Order-Line table.
You can also use several keyboard keys to navigate through records in the browse view. To use
a key, move the input focus to the browse by placing the pointer in the browse and clicking the
left mouse button, then press one of the keys described in Table 4–1.
Key Action
Page up Scrolls to the first record in the window and selects it.
Page down Scrolls to the last record in the window and selects it.
Home Scrolls to the first record in the browse and selects it.
End Scrolls to the last record in the browse and selects it.
Cursor down Scrolls down one record in the browse and selects it.
4–3
OpenEdge Reporting: Query/Results for Windows
Using frames
The query is contained within a portion of the window called a frame. By default, a browse uses
one frame for each query you create. Figure 4–2 shows an example of a browse view that
displays one query frame.
Query
frame
If a query includes more than one table, you can tell Results to split the contents of the tables
into two frames, allowing you to view the data more easily. See the “Using Master and Detail
sections to display records” section on page 6–3 for more information.
4–4
Using Query Views
Figure 4–3 illustrates a browse view that displays two query frames.
Frame
Frame
When you split the contents of a query into two frames, Results provides a set of navigation
buttons for each frame. The frames will overlap if there is not enough space to display them in
the window at the same time. To display both frames simultaneously, modify the frame
properties as described below.
You can also enlarge the window by clicking the maximize button or dragging the corner resize
handle in the window border.
4–5
OpenEdge Reporting: Query/Results for Windows
1. Choose Options→ Frame Properties. The Frame Properties dialog box appears:
2. Select the frame you want to modify from the Frames selection list.
• Row — Determines how many rows separate the menu line from the top of the
frame. Use this feature to stagger the location of the frames when you want to display
two frames simultaneously.
4. Choose OK.
4–6
Using Query Views
Form view
A form is an on-screen view that displays one record at a time. You typically use forms to add,
delete, and update one or more records in a table. Figure 4–4 shows an example of a Form.
Record
modifica-
tion buttons
Navigation
buttons
This form displays records in the Customer table one at a time. Press TAB to move through the
display fields within the record.
4–7
OpenEdge Reporting: Query/Results for Windows
Button Description
Modifying records
You can use forms to update, copy, add, and delete records contained in a single table.
For example, if a query consists of the fields in the Customer table, you can use the Form view
to modify the Customer table. However, if a query consists of fields from more than one table,
you cannot modify the tables unless you use the Master-Detail feature to break the tables into
individual frames. See the “Using Master and Detail sections to display records” section on
page 6–3 for more information.
The procedures in the following sections explain how to modify records contained within a
single table.
4–8
Using Query Views
Updating records
The following procedure describes how to update sections explain how to modify records
contained within a single table.
2. Choose Update.
Results displays the fields in the Update window. The first field is highlighted by default:
3. Select the contents of the field you want to modify, then type the new information in the
field. The new information overwrites the old information.
4. When you are done modifying fields, choose OK to save your modifications and close the
Update window.
As you update fields, you might find that your modifications are restricted by a variety of
factors. For example, you cannot update a calculated field because it is a display only field.
Or perhaps your company assigns unique customer numbers so you cannot update the
Cust-Num field.
4–9
OpenEdge Reporting: Query/Results for Windows
Copying records
The following section explains how to create a new record based on the contents of an old
record. Be sure to follow the guidelines at your site for creating new records based on existing
records.
2. Choose Copy.
Results copies the record and displays the copy in the Update window. Results copies all
the fields in the record whether or not the fields are displayed.
3. Since you are creating a new record, you will probably have to update several fields to
reflect the new information.
4. When you are done modifying fields, choose OK to save your new record and close the
update window.
4–10
Using Query Views
Creating records
1. Choose Add.
Results creates a new record that contains all the fields in the table, then displays the record
in the Add window. Note that only the fields you chose to display in the query are
displayed in the window:
Some of the fields might already contain values, as in the Credit-Limit field. These initial
values are determined by the business practices established by your company and enforced
by the database.
3. When you are done filling in fields, choose OK to save your record and close the Add
window.
Deleting records
To delete a record:
2. Choose Delete. A dialog box prompts you to verify that you want to delete the record.
3. Choose Yes. Results deletes the entire record, including fields that are not displayed in the
query.
4–11
OpenEdge Reporting: Query/Results for Windows
You might find that you cannot delete a particular record. For example, you might not be
able to delete a customer that has outstanding orders. Such restrictions are determined by
your company’s business practices and are enforced by your database.
Rearranging fields
Table 4–3 describes the type of field rearranging you can perform in the Form view.
To... Then...
Change the order in which fields display... Click and drag the field you want to move.
Lengthen the frame that contains the form... Drag a field to the bottom of the frame.
Shorten the frame that contains the form... Drag a field to the top of the frame.
Note: Moving a field within a form does not alter either the tab order for the fields or the order
in which they are displayed in other views. See the “Adding and removing display
fields” section on page 7–2 for more information about changing the tab order of fields.
4–12
Using Query Views
Using frames
A query is contained within a frame. By default, a form uses one frame for each query you
create. Figure 4–5 shows a query displayed within a frame:
Query
frame
However, if a query includes more than one table, you can tell Results to split the contents of
the tables into two frames, allowing you to view the data more easily. See the “Using Master
and Detail sections to display records” section on page 6–3 for more information.
4–13
OpenEdge Reporting: Query/Results for Windows
Frame
Frame
When you split the contents of a query into two frames, Results provides a set of navigation
buttons for each frame. The frames will overlap if there is not enough space to display them in
the window at the same time. To display both frames simultaneously, modify the frame
properties as described below.
You can also enlarge the window by clicking the maximize button or dragging the corner resize
handle in the window border.
4–14
Using Query Views
1. Choose Options→ Frame Properties. The Frame Properties dialog box appears:
2. Select the frame you want to modify from the Frames selection list.
• Row — Determines how many rows separate the menu line and the top of the frame.
Use this feature to stagger the location of the frames when you want to display
several frames simultaneously.
• Read-only — When activated, prevents you from modifying records in the database.
4. Choose OK.
If you activated Read-Only, then Add, Copy, Update, and Delete are grayed out.
4–15
OpenEdge Reporting: Query/Results for Windows
Report view
Field width
and
paper size
Display
field
labels
Display
field
formats
An on-screen report lists the field labels and display formats for the display fields you included
in the query. Display formats control the way data appears on-screen and in printed reports. For
example, the format for the Name field, (X20), means this field can display up to 20 characters.
See the “Changing display field properties” section on page 7–3 for more information.
Figure 4–8 uses Print Preview to approximate how the same report looks when printed.
4–16
Using Query Views
• Headers — A note at the top of a page. You can use one or all of the following headers:
a centered header printed on the first page of the report; a left, centered, or right header
printed on each page of the report.
• Footers — A note at a bottom of a page. You can use one or all of the following footers:
a centered footer printed on the last page of the report; a left, centered, or right footer
printed on each page of the report.
4–17
OpenEdge Reporting: Query/Results for Windows
To add a cover page, final page, headers, and footers to your document:
1. Choose Options→ Header and Footers. The Headers and Footers dialog box appears:
4–18
Using Query Views
3. Enter the information that you want to print within the header or footer. To enter the
information, do one or both of the following:
For example, you might want to type Customer Orders in a header for a report that
lists each customer’s orders. Note that you can enter information that spans several
lines by inserting a carriage return at the end of each line.
Functions insert a variable value into the element you create when you print the
report. For example, you can use a function to print the current date in every header
in your report.Table 4–4 lists the available functions.
Function Description
4–19
OpenEdge Reporting: Query/Results for Windows
Function Description
VALUE Inserts the current value of any field you select. You cannot
use this function for cover, first only, last only, and final
pages.
This is an example of a header that centers the words “Customer Orders” and the current
date on each page of the report:
4–20
Using Query Views
1. Choose Options→ Standard Page. The Standard Page dialog box appears:
2. Select the paper size you want to use, then choose OK.
4–21
OpenEdge Reporting: Query/Results for Windows
1. Determine the page size that most closely matches the page dimensions you need.
2. Choose Options→ Custom Page. The Custom Page dialog box appears:
Modify the attributes in this dialog box to reformat your report. Table 4–5 describes the
Custom Page attributes.
Attribute Description
Lines before header If you include a header in the report, determines the
number of blank lines inserted before the header.
Lines between header and If you include a header in your report, determines the
body number of blank lines inserted between the header
and the body of the report.
4–22
Using Query Views
Attribute Description
Lines Between Body and If you include a footer in the report, determines the
Footer number of blank lines inserted between the body of
the report and the footer.
4. When you are done reformatting the report, choose OK to save your changes.
Printing reports
The following procedure describes how to print a report.
To print a report:
2. Select the print settings you want to use, then choose OK.
4–23
OpenEdge Reporting: Query/Results for Windows
Label view
Figure 4–9 identifies the Label view.
Use the Label view to create and print labels. Since many labels, like mailing labels, often use
the same fields, Results lets you pick a set of default display fields. The default display fields
are selected by your system manager based on you company’s business practices. For example,
if you want to create mailing labels, you might tell Results to select the default display fields
from the Customer table.
To create labels:
1. Choose Query→ New→ Label. The Add/Remove Tables dialog box appears.
2. Select a table from the Available Tables selection list, then choose Add:
The table appears in the Selected Tables selection list. As you add tables, the Available
Tables selection list is updated to display only tables that have a relationship with the table
you selected.
4–24
Using Query Views
A dialog box prompts you to choose whether you want Results to select the display field
for you.
Results selects the fields based on the criteria set by your site manager. Thus, some
tables might contain numerous display fields and other tables might contain no
default display fields. If you want to change the default display fields for a particular
table, see your site manager.
• Choose No to display the Add/Remove Fields dialog box and select the display
fields yourself.
The Add/Remove Fields dialog box appears. The dialog box lists the display fields in the
order in which they will appear in the labels:
4–25
OpenEdge Reporting: Query/Results for Windows
6. To accept the list of display fields as is, choose OK. To modify the list, insert fields, delete
fields, or change the order of the fields as follows:
• To insert a display field, place the cursor where you want to insert the field, then
choose Insert Field. The Insert Field dialog box appears. Select a field, then choose
OK.
• To delete a display field, select the field then press either CTRL-X or DELETE.
• To change the order of a display field, select the field then press CTRL-X. Position the
cursor where you want to insert the field, then press CTRL-V.
• To restore the list of display fields to its original condition, choose Restore Layout.
Label
dimensions
Display
fields
Note: The Field→ Aggregates menu selection is not available with the Label view. The
Field→ Properties menu selection is only available for calculated fields.
4–26
Using Query Views
The following figure uses Print Preview to show how the labels look when they are printed:
1. Choose Options→ Standard Label. The Standard Label dialog box appears:
4–27
OpenEdge Reporting: Query/Results for Windows
2. Select the label type you want to use, then choose OK.
1. Determine which label type is most suitable. The label type you choose will serve as the
basis for your new label.
Choose Options→ Custom Label. The Custom Label dialog box appears:
Use the custom label attributes in the dialog box to reformat the label. Table 4–6 describes
the custom label attributes.
Attribute Description
4–28
Using Query Views
Attribute Description
3. When you are done reformatting the label, choose OK to save your changes.
Printing labels
The steps to print labels are relatively simple.
To print labels:
2. Select the print settings you want to use, then choose OK.
4–29
OpenEdge Reporting: Query/Results for Windows
Export view
The following icon identifies the Export view:
Use the Export view to generate ASCII files to use with other software applications. For
example, you can use the Export view to create an ASCII file that contains fields from the
Customer table, then use the contents of the ASCII file to customize form letters you create from
within a word processing application. You can also use the contents of an ASCII file from
within a graphics application to create presentations.
Figure 4–11 shows an export query, and Figure 4–12 shows the ASCII file that is generated by
the data in Figure 4–11.
Display
fields
This export query contains display fields from the Customer table. The format attributes
determine how the contents of these fields are formatted for the ASCII file. See the “Modifying
export types” section on page 4–33 for more information about format attributes.
4–30
Using Query Views
Figure 4–12 uses Print Preview to show the ASCII file generated by the Export query. You can
use Print Preview to view ASCII export data.
Applications often differ in the way they expect ASCII files to be formatted. Thus, Results
provides several export types to format data for a variety of applications:
• ASCII.
4–31
OpenEdge Reporting: Query/Results for Windows
• Progress.
• SYLK.
Note: If none of the export types is suitable, you can temporarily modify an existing export
type by overriding the values of one or more of its format attributes. See the “Modifying
export types” section on page 4–33 for more information.
By default, Results uses the export type called Progress to generate ASCII files.
See the documentation for the application in which you plan to incorporate the data file to
determine which export format to use.
2. Choose Options→ Standard Export. The Standard Export dialog box appears:
3. Select the export type you want to use, then choose OK.
4–32
Using Query Views
1. Choose Query→ Print→ To File. The Print to File dialog box appears:
By default, Results names the file export.txt and saves it in your working directory. You
can change the defaults, as follows:
• To rename the file, type a new file name in the File field.
• To change the directory in which the file is located, either type the full pathname and
filename in the File field, or choose Files and change the directory.
• To append the file to the end of an existing ASCII file, first activate the Append to
Existing File toggle box, then in the File field, enter the name of the existing file to
which you want to append the file.
4–33
OpenEdge Reporting: Query/Results for Windows
1. Determine which export type most closely matches the format you need.
2. Choose Options→ Custom Export and select the attribute you want to modify. Table 4–7
describes these attributes.
Attribute Description
Field delimiter The field delimiter string. The field delimiter string is
the set of characters used to indicate the beginning
and end of each field value.
Field separator The field separator string. The field separator string is
the set of characters that separates each field value
within a record.
4–34
Using Query Views
• The Output Headers and Fixed Width options toggle between Yes and No. When
you set the value to Yes, a check mark appears next to the option name within the
menu.
• The Record Start, Record End, Field Delimiter, and Field Separator options
display a dialog box that allows you to enter the codes for the string. See “Modifying
strings” section on page 4–35 for more information about modifying these attributes.
Modifying strings
You can enter up to 16 codes for each string. Enter these codes from left to right and top to
bottom:
4–35
OpenEdge Reporting: Query/Results for Windows
• Choose Pick From ASCII Table and choose a control symbol from the ASCII Codes
dialog box.
4–36
5
Changing the Query Selection Criteria
A query’s selection criteria determine which records the query returns from the database and
the order in which it returns them. This chapter explains several ways you can change the
selection criteria for a query.
• Sorting records
• Creating filters
• To add a table, select the table from the Available Tables selection list and choose
Add.
• To remove a table, select the table from the Selected Tables selection list and choose
Remove.
3. When you are done adding tables to and removing tables from the query, choose OK.
Results displays the Add/Remove Fields dialog box, so you can add or remove display
fields. Note that when you remove a table, Results automatically removes the display
fields associated with the table.
4. To add a display field, select the field from the Available Fields selection list and choose
Add.
5–2
Changing the Query Selection Criteria
5. In the Selected Fields selection list, the fields are listed in the order they will be displayed
in the query view (from left to right). To reorder the display fields, select a field and choose
either Move Up or Move Down.
Select the fields, then choose Add to include them in the layout. Notice that the field list
includes not only database fields, but also includes any calculated fields you defined for
the query. Use Move Up and Move Down to position the order of the fields in the layout:
If you want to include information in a calculated field, but did not create the fields before
accessing Label view, choose Field→ Add Calculated Field from the menu bar, then
create the field. Results inserts the calculated field in the label layout at the cursor position.
See the “Creating calculated fields” section on page 6–8 for information about creating
calculated fields.
Note: Because the Form view lets you change the position of the fields by dragging the
fields in the display, Move Up and Move Down do not change the position of the
fields. They simply change the tab order for the fields.
5–3
OpenEdge Reporting: Query/Results for Windows
• Partial
When you create a query, Results automatically establishes a partial relationship between
each pair of tables in the query. A partial relationship, also called an inner join, accesses
only those records in the first table that have related records in the second table.
• Complete
If you want to access all the records in the first table whether or not they have related
records in the second table, change the relationship to a complete relationship. A complete
relationship is also called an outer join.
If you set a complete relationship between a pair of tables and use sort ordering to control
the order in which the query retrieves records, Results automatically uses the primary
index in the first table in the relationship as the first sort field. See the “Sorting records”
section on page 5–7 for more information.
5–4
Changing the Query Selection Criteria
For example, you might have a query that displays the invoices for your customers by invoice
date, as shown in Figure 5–1.
Sorted in
ascending
order by
Invoice-Date
If you change the table relationship for the query presented in Figure 5–1 to a complete
relationship, Results will automatically use the Cust-Num field (primary index in the first table)
then the Invoice-Date field to sort the query. Thus the query will display the records by invoice
date for each customer.
Note that the values for aggregate subtotals and totals only associated with fields from the
second table will change to reflect the new sort order when you change the table relationship to
a complete relationship. For example, if you created an aggregate total to total the amount of the
invoices by date, then changed the relationship between the Customer and Invoice tables to a
complete relationship, the aggregate total would then total the amount of the invoices by date
for each customer.
See the “Record displays in multi-table queries” section on page 3–8 for examples of partial and
complete relationships.
5–5
OpenEdge Reporting: Query/Results for Windows
1. Choose Table→ Relationship Types. The Relationship Types dialog box appears:
Complete
join
Partial
join
Note: Partial relationships are displayed in white and complete relationships are
displayed in reverse video.
2. To change the type of relationship between a pair of tables, simply select the pair of tables
you want to modify. Results automatically toggles to the opposite relationship type.
5–6
Changing the Query Selection Criteria
Sorting records
By default, Results uses the primary index from the first table you included in the query to
determine the order in which it retrieves and displays records.
Figure 5–2 displays the items ordered by each customer. Note that Results automatically uses
the primary index, Cust-Num, within the Customer table to sort the records in ascending order
by customer number.
Sorted in
ascending
order by
Cust-Num
You can alter the order in which the query retrieves records by choosing one or more fields as
the criteria for sorting the records.
5–7
OpenEdge Reporting: Query/Results for Windows
For example, you might prefer to see the list sorted by order number, starting with the most
recent order. In this case, you use the Order-Num field to sort the records in descending order,
as shown in Figure 5–3.
Sorted in
descending
order by
Order-Num
Figure 5–3: Query displaying ordered items by order number and date
5–8
Changing the Query Selection Criteria
Then you might decide that you want to retrieve the orders for each customer, starting with the
most recent order. In the Sports database, the order number increases with each new order.
Therefore, you use two fields to sort the records: Cust-Num and Order-Num. Cust-Num is
sorted in ascending order and Order-Num is sorted in descending order, as shown in
Figure 5–4.
Sorted in
ascending order
by Cust-Num
and...
... in descending
order by
Order-Num
You can sort on all database fields and on the following types of calculated fields: Math, String
Function, Numeric Function, Date Function, and Logical Function. See Chapter 6, “Analyzing
Data,” for more information on the different types of calculated functions.
Break groups are useful because they allow you to perform calculations on a subset of records
in the query. For example, you can count the number of orders for each individual customer or
even calculate the total Extended-Price for the items each customer ordered. See the “Creating
aggregate totals and subtotals” section on page 6–41 for more information about performing
calculations on break groups.
5–9
OpenEdge Reporting: Query/Results for Windows
1. Choose Data→ Sort Ordering. The Sort Order Fields dialog box appears.
Notice that the Available Fields selection list contains all the fields in the query. You can
use any field to sort records, including some calculated fields and fields that are not
displayed in the query view. The available calculated fields appear at the top of the
Available Fields list:
2. You can use up to 16 fields to sort the records in the query. To choose the sort fields, select
the fields from the Available Fields selection list, then choose Add.
5–10
Changing the Query Selection Criteria
3. The fields appear in the Selected Fields selection list. Note that the fields appear in the
order in which Results uses them to sort the records:
Sorted by Cust-Num,
then Order-Num
4. If you selected only one sort field or you are satisfied with the order of the sort fields, go
to Step 5. Otherwise, to change the order of the sort fields, select one field at a time and
choose either Move Up or Move Down.
5. By default, the fields are sorted in ascending order. To sort a field in descending order,
select the field, then choose Descending:
6. When you are done setting the sort criteria, choose OK to update the sort order and
redisplay the query.
5–11
OpenEdge Reporting: Query/Results for Windows
Creating filters
When you create a query, Results retrieves all the records in the tables you select. However,
sometimes you might want to retrieve only a subset of these records. For example, you might
want to refine the selection criteria for a query that retrieves customer invoices to retrieve only
those invoices for customers in Massachusetts. You might further refine the query to retrieve
only those invoices for customers in Massachusetts who have not paid for their merchandise.
To do this, you use a filter to create a set of instructions, called a WHERE clause, to instruct the
query to retrieve only those records where the State field equals Massachusetts and the Balance
field is greater than 0. In this example, the WHERE clause is written as follows:
In this example, State and Balance are fields; MA is compared to State using the equality
operator (=); 0 is compared to Balance using the greater than operator (>); the logical operator
AND bonds the two sections of the clause, called expressions, together. See Appendix B,
“Comparison Operators,” for a description of the available comparison operators.
Results makes creating a WHERE clause easy. Just select the elements you want to include in the
clause and Results generates and formats the clause for you. If, however, you prefer to write and
format clauses yourself, Results lets you create a WHERE clause manually.
Results provides you with two similar techniques to generate a WHERE clause:
• Data selection
• Query by example
Data Selection
Data selection lets you generate a WHERE clause either manually, or by selecting fields and
operators and allows Results to format the WHERE clause for you. The WHERE clause can be
based on any field from within any table in the query, whether or not the field is a display field.
Data selection also gives you the opportunity to set the selection criteria at run time. This feature
is available for all views.
5–12
Changing the Query Selection Criteria
Query by example
Query by example uses a blank form to help you generate a WHERE clause based on one or more
display fields. This feature is available only in Form view.
1. Choose Data→ Selection. If there is more than one table available, the Available Tables
dialog box appears.
2. Select the table that contains the fields you want to use to limit the query, then choose OK.
If you are creating a WHERE clause that contains more than one expression and these
expressions contain fields from different tables, create the expressions in increments.
Select the first table and create the first expression, then select another table to create the
second expression, and so on until you complete the clause.
5–13
OpenEdge Reporting: Query/Results for Windows
3. If you want Results to prompt you to set your selection criteria at run time, activate the
Ask At Runtime toggle box.
By default, Data Selection does not use Ask At Runtime. This means that the values you
enter in the WHERE clause are the only values used to select data. To change the selection
criteria, you must re-enter Data Selection and create a new WHERE clause. Ask At
Runtime lets you modify the values for one or more fields in the WHERE clause each time
you run the query. For example, you can tell Results to prompt you for a value to compare
to the State field each time you run a query. See the “Setting Data Selection at run time”
section on page 5–19 for more information.
4. Double click the field you want to use to refine the selection criteria.
Results displays the field in the Selection Criteria text box at the bottom of the screen.
5–14
Changing the Query Selection Criteria
5. Select the comparison operator you want to use to compare a value to the field. See
Appendix B, “Comparison Operators,” for a description of these operators.
• If you activated the Ask At Runtime toggle box, the Ask At Run Time Prompt
dialog box appears:
Type a question that will prompt you to enter a value for the field when you open or
run the query. For example, if you are comparing a value to the State field, you might
type Enter a State. Then choose OK.
• If you did not activate the Ask At Runtime toggle box, the Enter Constant dialog
box appears:
Type the value you want to compare to the field, then choose OK. Do not place quotation
marks around the value. If quotation marks are required, Results will automatically insert
the quotation marks for you when it formats the WHERE clause.
Results formats the WHERE clause and displays it in the Selection Criteria area.
5–15
OpenEdge Reporting: Query/Results for Windows
• If the WHERE clause is complete, choose OK and redisplay the query based on your
selection criteria.
• If you want to add another expression to the WHERE clause based on a field in the
current table, determine whether you want to use the AND or the OR logical operator
to join the next expression to the expression you just created. Then choose either
AND or OR at the bottom of the dialog box.
The AND operator means both the combined expressions must be true for the record
to be selected. If you use State = “MA” AND Balance > 0, Results selects only those
records where the customer is from Massachusetts and the customer has a positive
balance.
The OR operator means only one of the combined expressions must be true for the
record to be selected. If you use State = “MA” OR Cust-Num < 50, Results selects
all the records between 1 and 49 plus those records where the customer is from
Massachusetts.
• If the expression you want to add to the WHERE clause is based on a field in a
different table, choose OK to save the WHERE clause and redisplay the query based
on your selection criteria. Then start with Step 1 in this procedure to create the
expression.
When you open the table to create the new expression, the previous expression is not
displayed in the Selection Criteria text box. Each table displays its own portion of
the WHERE clause only. Results automatically uses the AND operator to join
expressions from different tables together and create the WHERE clause for you.
7. Repeat Step 3 through Step 6 in this procedure to add an expression to the WHERE clause
based on a field in the same table.
5–16
Changing the Query Selection Criteria
Once you are familiar with automatically creating WHERE clauses using Data Selection, you can
create and edit WHERE clauses manually.
2. Select the table that contains the fields you want to use to limit the query, then choose OK.
If you are creating a WHERE clause that contains more than one expression and these
expressions contain fields from different tables, create the expressions in increments.
Select the first table and create the first expression, then select another table to create the
second expression, and so on until you complete the clause.
3. Position the pointer in the Selection Criteria text box and click to place the insertion point
in the upper-left corner of the editor.
4. Type the WHERE clause in the Selection Criteria editor. See Appendix B, “Comparison
Operators,” for a description of the comparison operators you can use to compare values
within the WHERE clause.
5–17
OpenEdge Reporting: Query/Results for Windows
• Use the complete name for each field in the WHERE clause. A complete field name
consists of the database name, the table name, and the field name separated by
periods (.). For example, type sports.Customer.City where sports is the name of the
database, customer is the name of the table, and city is the name of the field.
5. When you are done entering the WHERE clause, choose Now to check the syntax for the
clause. An alert box appears.
6. Choose Cancel. If the syntax is incorrect, fix the error and recheck the syntax.
7. Choose OK to save the WHERE clause and close the Data Selection dialog box.
5–18
Changing the Query Selection Criteria
When you use Data Selection to create a WHERE clause, you can choose the Ask At Runtime
option. Choosing Ask At Runtime means that instead of entering a comparison value when you
create the WHERE clause, Results prompts you to enter the value when you run the query. This
means that you can enter the value when you run the query in an application outside of Results
or when you change to the Browse or Form view. When you use the Report, Labels, and
Export views, Results does not prompt you to enter a value until you either print the query or
use Print Preview.
To enter a value, type the value in the Ask At Runtime dialog box, then click OK. Note that
you do not have to place quotation marks around the value. If the value requires quotation
marks, Results automatically inserts them:
To reset the value from within the Form and Browse views, choose Data→ Re-Ask Questions,
then type a value in the Ask At Runtime dialog box. To reset the value from within the Report,
Labels, and Export view, simply reprint the query or use Print Preview.
Use the following procedure to remove a WHERE clause created using Data Selection.
5–19
OpenEdge Reporting: Query/Results for Windows
2. Select the table that contains the expression you want to remove. The Data Selection
dialog box appears:
3. Select the WHERE clause, then press DELETE to remove the clause.
4. Choose OK to save your changes and close the Data Selection dialog box.
5. If you created an expression for another table, repeat Steps 1 through 4 for every table that
contains an expression.
5–20
Changing the Query Selection Criteria
1. Choose Query by Example at the bottom of the form. A blank form appears:
You can use any of these fields to modify the selection criteria for the query.
2. Go to the first field you want to use and type the selection criteria for the field.
The selection criteria for a field consists of an operator and the value you want the operator
to work on. For example, to retrieve all the unpaid invoices, type > 0 in the Balance field.
You can use the following comparison operators: =, <>, <, >, <=, >=, Begins, Matches, and
Contains. See Appendix B, “Comparison Operators,” for a description of these operators.
If you do not enter a comparison operator in the selection criteria, Query by Example
automatically uses the equality operator.
You do not have to place quotation marks (“”) around text strings unless the first word in
the text string happens to be the name of a comparison operator. For example, to select all
the records that pertain to customers in Massachusetts, type “MA” in the State field.
5–21
OpenEdge Reporting: Query/Results for Windows
3. If you want to further refine the selection criteria, enter the selection criteria for one or
more additional fields. For example, to display unpaid invoices for the first 49 customers,
type <= 49 in the Cust-Num field and > 0 in the Balance field:
4. When you are finished defining the selection criteria, choose OK.
Results saves the selection criteria as a WHERE clause and retrieves the matching records.
Note that once you create a WHERE clause, Results maintains the WHERE clause until you
change or delete it.
• Use Data Selection to locate the WHERE clause, select it, and delete it.
Note: Although Data Selection displays WHERE clauses you create using Query by Example,
Query by Example does not display WHERE clauses you create using Data Selection.
5–22
Changing the Query Selection Criteria
For example, if you run a query that displays the customer name and balance, Results displays
all the customers in the selected tables. You can use the Data Governor to display only the first
20 records.
You can only use the Data Governor in the Report, Label, and Export views.
3. Activate the Include in Generated Code toggle box if you want to include this limit in
the generated code.
This means that when you run the query from an application, Results displays only the
number of records specified in the Number of Records field. If you do not activate this
toggle box, Results displays all the records when you run the query from an application.
4. Choose OK.
5–23
OpenEdge Reporting: Query/Results for Windows
5–24
6
Analyzing Data
Results provides a variety of techniques for analyzing the data in your queries. This chapter
presents:
• Overview
• Calculated fields
• Aggregate fields
Overview
Table 6–1 identifies and briefly describes each Results data analysis technique that is described
in this chapter.
Master and Detail sections Split the query view into “Using Master and Detail
Master and Detail sections to sections to display
reduce the display of records” section on
repetitive information. page 6–3
6–2
Analyzing Data
For example, if your query uses fields from the Customer, Order, and Order-Line tables to list
the items each customer ordered, Results places the records in one section by default, as in the
Figure 6–1.
Figure 6–1: Default query display for records from multiple tables
In this example, the query retrieves a record for each item number within each order. Many of
the records contain identical information. To reduce the amount of repetitive information
displayed in the view, you can split the view into two sections, Master and Detail. A Master
section begins a new order and its corresponding Detail section contains the specific items
ordered. You can use the Master-Detail option with the Browse, Report, and Form query
views.
6–3
OpenEdge Reporting: Query/Results for Windows
Splitting composite records into Master and Detail sections does not alter the way in which the
query retrieves the records. as the example query view shows in Figure 6–2, it simply alters the
way in which Results displays the records within the query view.
Master
section for
order # 6
Detail
section for
order # 6
Master
section for
order # 36
Detail
section for
order # 36
In Figure 6–2, the Master section contains fields from the Customer and Order tables and the
Detail section contains fields from the Order-Line table.
6–4
Analyzing Data
2. Determine how you want to split the tables, then select a break point and choose OK.
When you split composite records into Master and Detail sections the Form or Browse
views, Results automatically places each section in its own frame. See the “Browse view”
section on page 4–2 and “Form view” section on page 4–7 for more information about
frames.
To remove the Master and Detail sections and display composite records in one section:
6–5
OpenEdge Reporting: Query/Results for Windows
Calculated fields
So far you have displayed fields that already exist in the database. However, you can create your
own column of data, called calculated fields, to help you analyze the information in your query.
For example, you can create a field called Total Price that automatically multiplies the price of
each item a customer orders by the number of items ordered, as shown in Figure 6–3.
Total
Price
multiplies
the value
of the
Price and
Qty fields
for each
record in
the
database.
6–6
Analyzing Data
Calculated fields are display fields only, so neither the field nor its contents are saved to the
database. Table 6–2 shows the types of calculated fields you can create.
Calculated field
types Description Availability
Percent of total Expresses the percent of total that the Available in the Report
value of a field represents within the and Export views only.
query. For example, you can display the
percent of total for each sales
representative’s monthly sales figures.
Running total Displays the running total of any numeric Available in the Report
field or expression. A running total and Export views only.
increments for each line of the query. That
is, the value displayed in that column on
any line in the query is the sum of the field
value for that and all previous lines in the
query. For example, if the value in the first
record is 1 and the value in the second
record is 3, the running total for the first
line is 1 and the running total for the
second record is 4 (1 plus 3).
Lookup Displays the value of a field from a table Available in all the
not included in the query. query views except
Labels.
String function Defines a display field based on a string Available in all views.
expression.
6–7
OpenEdge Reporting: Query/Results for Windows
Calculated field
types Description Availability
Numeric function Defines a display field based on a numeric Available in all views.
expression.
Date function Defines a display field based on a date Available in all views.
calculation.
Logical function Defines a logical display field based on Available in all views.
the value of one or more fields in the
query.
1. Choose Field→ Add Calculated Field, then select the field you want to create.
Results displays the Add Field dialog box for the type of calculated field you selected. The
following sections describe these dialog boxes.
2. Use the Add Field dialog box to specify the parameters for the field, then choose OK. The
Properties dialog box appears.
For example, you can choose Assistant to modify how the data in the field is displayed.
You can also change the name of a calculated field by selecting Rename. See the
“Renaming calculated fields” section on page 6–36 for more information.
3. Set the properties for the field you created. See the “Changing display field properties”
section on page 7–3 for more information.
6–8
Analyzing Data
The Add Field - Percent of Total dialog box lets you specify the field for which you want to
calculate the percent of total.
For example, Figure 6–4 uses Percent of Total to calculate each sales representative’s percent
of total for the month of January.
6–9
OpenEdge Reporting: Query/Results for Windows
The Add Field - Running Total dialog box lets you select the field for which you want to
calculate a running total.
Figure 6–5 lists the running total for the Total-Paid field.
6–10
Analyzing Data
Adding a Counter
The Add Field - Counter dialog box lets you specify the parameters for the Counter field:
• Sections used in — Select the sections you want to count: Master, Detail, or both. See
“Using Master and Detail sections to display records” section on page 6–3 for more
information about Master and Detail sections.
6–11
OpenEdge Reporting: Query/Results for Windows
The example presented in Figure 6–6 uses the Counter field to count the total number of orders
in the Master section.
When a field consists of several elements, each of which contains its own value, the field is
called an array. By default, the values in the array are listed horizontally. To list them in a
vertical column, use the Stacked Array Calculated field.
The Add Field - Stacked Array dialog box lets you specify the array you want to stack
vertically.
6–12
Analyzing Data
In Figure 6–7, the Stacked Array field displays the contents for Month-Quota in a vertical
column.
6–13
OpenEdge Reporting: Query/Results for Windows
The Add Field - Lookup Source dialog box allows you to display the value of a field in a table
not currently in the query.
To use this option, both the table that contains the field you want to display and one of the tables
in your query must contain a field that stores the same kind of information. This similarity
between the two fields lets you establish a relationship between the two tables.
As shown in Figure 6–8, you might use a field in the Customer table called Cust-Num and a
field in the Invoice table called ID-Num to identify your customers. In this case, they both store
a set of numbers that identify your customers.
See the “Record displays in multi-table queries” section on page 3–8 and the “Changing table
relationships in multi-table queries” section on page 5–4 for more information about table
relationships.
6–14
Analyzing Data
1. Select a field from one of the tables in your query that contains the same type of
information as a field in the table with which you are establishing a relationship.
2. Choose OK. The Add Field - Lookup Matching Field dialog box appears:
3. Select the table that contains the field you want to look up.
4. Select a field that contains the same type of information as the field you selected in Step
1. This establishes a relationship between the two tables.
6–15
OpenEdge Reporting: Query/Results for Windows
5. Choose OK. The Add Field - Lookup Display Field dialog box appears:
6. Select the field that contains the information you want to display.
7. Type a value to display in place of the lookup field when Results cannot find a matching
field value in one or more records. By default, Results displays a question mark (?) when
it cannot find a value.
8. Choose OK.
The following example displays a lookup field called Region from a table called State that
is not included in the query:
6–16
Analyzing Data
The Add Field - Math dialog box allows you to create a math expression based on the value of
two fields. When you select the Math option, Results displays the Add Field - Math dialog
box:
1. Select the mathematical type of function to perform. Results lists the available display
fields in the Function/Field selection list and displays an empty expression based on the
function you choose:
6–17
OpenEdge Reporting: Query/Results for Windows
2. Double click one of the following to create the first part of the expression:
• A field — Uses the value of the field in the first part of the expression.
• Constant value — Lets you enter a value to use in the first part of the expression.
For example, you can use constant value field to insert a number to calculate within
the expression.
• Subexpression — Lets you enter a subexpression as the first value in the expression.
A subexpression is an expression within another expression.
Results creates the first part of the expression and displays it in the Expression field at the
bottom of the dialog box.
3. If the expression contains a second value, double click a field, constant value, or
subexpression to create the last part of the expression.
Results creates the remaining part of the expression and displays the entire expression in
the Expression selection list:
6–18
Analyzing Data
The following example contains a calculated field named Total Price that multiplies the
value of the Price and Qty fields for each record in the query:
6–19
OpenEdge Reporting: Query/Results for Windows
The Add Field - String Function dialog box allows you to create a string expression:
1. In the Function/Field selection list, double click the function you want to perform.
Table 6–3 describes these functions.
Function Description
6–20
Analyzing Data
Function Description
String constant or field Lets you to build an expression with either a string constant
or the value of a character field.
2. Double click one of the following to create the first part of the expression:
• A field — Uses the value of the field in the first part of the expression.
• Constant value — Lets you enter a value to use in the first part of the expression.
For example, you could use constant value to insert a comma or a space within a
string.
• Subexpression — Lets you enter a subexpression as the first value in the expression.
A subexpression is simply an expression within another expression.
Results creates the first part of the expression and displays it in the Expression field at the
bottom of the dialog box.
6–21
OpenEdge Reporting: Query/Results for Windows
3. If your expression contains a second value, double click a field, constant value, or
subexpression to create the last part of the expression.
Results creates the remaining part of the expression and displays the entire expression in
the Expression field:
The following example shows the results. It contains a calculated field named City/State
that uses the Combine String function to combine the values of the City and State fields
into one field:
6–22
Analyzing Data
Note that the City/State field uses a constant value that contains a comma and space to
separate the city and state. This constant value is added to the expression through a
subexpression. Figure 6–9 illustrates the expression used in this example.
Subexpression
Use the Numeric Function to create a numeric expression. When you select the Numeric
Function option, Results displays the Add Field - Numeric Function dialog box:
6–23
OpenEdge Reporting: Query/Results for Windows
1. In the Function/Field selection list, double click the function you want to perform.
Table 6–4 describes these functions.
Function Description
Absolute value Returns the absolute value of a number. The absolute value
is the positive value of a given number. For example, the
absolute value of -3 is 3; the absolute value of 5 is 5.
Cube root Returns the cube root of a number. The cube root of a
number is a number that when multiplied by itself three
times, equals the number. For example, the cube root of 8 is
2 (2*2*2).
Greater of two Returns the largest number from a list of numbers. For
numbers example, if a list consists of two numbers, 24 and 55, the
function returns 55.
Log base e Returns the logarithm based on the value e. The value of e
is 2.7182818.
Log base n Returns the natural logarithm for a number for a given base.
For example, 25 is 32. The natural logarithm for 32 with
base 2 is 5.
6–24
Analyzing Data
Function Description
Smaller of two Returns the smaller of two numbers. For example, if the
numbers function compares the numbers 18 and 29, it returns the
number 18.
Square root Returns the square root of a number. For example, the
square root of 9 is 3.
• Displays an empty expression based on the function you chose in Step 1 within the
Expression scroll box.
2. Double click one of the following to create the first part of the expression:
• A field — Uses the value of the field in the first part of the expression.
• Constant value — Lets you enter a value to use in the first part of the expression.
For example, you can enter a number to calculate within the expression.
• Subexpression — Lets you enter a subexpression as the first value in the expression.
A subexpression is simply an expression within an expression.
Results creates the first part of the expression and displays it in the Expression field at the
bottom of the dialog box.
6–25
OpenEdge Reporting: Query/Results for Windows
3. If the expression contains a second value, double click a field, constant value, or
subexpression to create the last part of the expression.
Results creates the remaining part of the expression and displays the entire expression in
the Expression field:
Figure 6–10 contains a calculated field named Round Amount that rounds the amount of each
customer’s invoice to the nearest whole dollar.
6–26
Analyzing Data
The Add Field - Date Function dialog box, shown in Figure 6–11, allows you to define a date
calculation.
1. In the Function/Field selection list, double click the function you want to perform.
Table 6–5 describes these functions.
Function Description
Add days to date value Adds the number of days you specify to a date and returns
the value.
Day of month Returns the day of the month for the date you specify.
Day of week Returns the day of the week for the date you specify in
numeric format, where the value “1" begins with Sunday.
6–27
OpenEdge Reporting: Query/Results for Windows
Function Description
Earlier of two dates Returns the earlier of two dates. For example, if the
function compares the dates 01/05/95 and 01/09/99, it
returns 01/05/95.
If first expression is Defines an expression that makes a decision. If the first part
true return second else of the expression is true, the function returns the second
third date date; if the first part of the expression is not true, the
function returns the third date.
Later of two dates Returns the later of two dates. For example, if the function
compares the dates 01/05/95 and 01/09/99, it returns
01/09/99.
Month of year Returns the number of the month for the date you specify.
Subtract days from Subtracts the number of days you specify from a date and
date value returns the value.
Year value Returns the year for the date you specify. For example, the
date 04/05/99 is returned as 1999.
6–28
Analyzing Data
• Displays an empty expression based on the function you chose in Step 1 within the
Expression editor box:
2. Double click one of the following to create the first part of the expression:
• A field — Uses the value of the field in the first part of the expression.
• Constant value — Lets you enter a date to use in the first part of the expression.
• Current date — Uses the current date each time you run the query.
• Subexpression — Lets you enter subexpression as the first value in the expression.
Results creates the first part of the expression and displays it in the Expression field at the
bottom of the dialog box.
6–29
OpenEdge Reporting: Query/Results for Windows
3. Double click a field, constant value, current date, or subexpression to create the last part
of the expression.
Results creates the remaining part of the expression and displays the entire expression in
the Expression field:
The following example contains a calculated field named Delivery Time that uses the
Differences Between Two Dates function to calculate the difference between the Ordered
and Shipped dates. Note that a question mark displays in the Delivery Time field for those
records that Results cannot calculate because the order has not shipped:
6–30
Analyzing Data
The Add Field - Logical Function dialog box allows you to create a logical expression:
1. In the Function/Field selection list, double click the function you want to perform.
Table 6–6 describes these functions.
Note: Many of the functions in Table 6–6 contain comparison operators. See
Appendix B, “Comparison Operators.”
Function Description
Begins Returns the logical value “yes” for strings that begin with
the letter you specify or the logical value “no” for strings
that do not begin with the letter you specify.
Dates equal Returns the logical value “yes” for dates equal to the value
you specify or the logical value “no” for dates not equal to
the value you specify.
6–31
OpenEdge Reporting: Query/Results for Windows
Function Description
Dates greater or equal Returns the logical value “yes” for dates larger or equal to
the value you specify or the logical value “no” for dates
smaller than the value you specify.
Dates greater than Returns the logical value “yes” for dates larger than the
value you specify or the logical value “no” for dates smaller
or equal to the value you specify.
Dates less or equal Returns the logical value “yes” for dates smaller or equal to
the value you specify or the logical value “no” for dates
larger than the value you specify.
Dates less than Returns the logical value “yes” for dates smaller than the
value you specify or the logical value “no” for dates larger
or equal to the value you specify.
Dates not equal Returns the logical value “yes” for dates not equal to the
value you specify or the logical value “no” for dates equal
to the value you specify.
Logical AND Lets you join two logical expressions together. The
function returns the value “yes” when both expressions are
true and the value “no” when either one or both expressions
are false.
Matches Returns the logical value “yes” for strings that match the
characters you specify or the value “no” for strings that do
not match the characters you specify.
Negate logical Returns the logical value “no” for logical expressions that
expression (NOT) are true and the logical value “yes” for logical expressions
that are false.
Numbers equal Returns the logical value “yes” for numbers equal to the
value you specify or the logical value “no” for numbers not
equal to the value you specify.
Numbers greater or Returns the logical value “yes” for numbers larger or equal
equal to the value you specify or the logical value “no” for
numbers smaller than the value you specify.
6–32
Analyzing Data
Function Description
Numbers greater than Returns the logical value “yes” for numbers larger than the
value you specify or the logical value “no” for numbers
smaller or equal to the value you specify.
Numbers less or equal Returns the logical value “yes” for numbers smaller or
equal to the value you specify or the logical value “no” for
numbers larger than the value you specify.
Numbers less than Returns the logical value “yes” for numbers smaller than
the value you specify or the logical value “no” for numbers
larger or equal to the value you specify.
Numbers not equal Returns the logical value “yes” for numbers not equal to the
value you specify or the logical value “no” for numbers
equal to the value you specify.
Strings equal Returns the logical value “yes” for strings equal to the value
you specify or the logical value “no” for strings not equal to
the value you specify.
Strings greater or Returns the logical value “yes” for strings larger or equal to
equal the value you specify or the logical value “no” for strings
smaller than the value you specify.
Strings greater than Returns the logical value “yes” for strings larger than the
value you specify or the logical value “no” for strings
smaller or equal to the value you specify.
Strings less or equal Returns the logical value “yes” for strings smaller or equal
to the value you specify or the logical value “no” for strings
larger than the value you specify.
Strings less than Returns the logical value “yes” for strings smaller than the
value you specify or the logical value “no” for strings larger
or equal to the value you specify.
Strings not equal Returns the logical value “yes” for strings not equal to the
value you specify or the logical value “no” for strings equal
to the value you specify.
6–33
OpenEdge Reporting: Query/Results for Windows
2. Double click one of the following to create the first part of the expression:
• A field — Uses the value of the field in the first part of the expression.
• Constant value — Lets you enter a date to use in the first part of the expression.
• Current date — Uses the current date each time you run the query.
• Subexpression — Lets you enter subexpression as the first value in the expression.
A subexpression is an expression within an expression.
Results creates the first part of the expression and displays it in the Expression field at the
bottom of the dialog box.
3. If your expression contains a second value, double click a field, constant value, current
date, or subexpression to create the last part of the expression.
Results creates the remaining part of the expression and displays the entire expression in
the Expression field:
6–34
Analyzing Data
5. By default, Results uses the display values yes and no to represent true and false. To
substitute a different set of display values for true and false, choose Assistant in the
Properties dialog box and modify the display values. See “Changing display field
properties” section on page 7–3 for more information.
The following example contains a calculated field named On Time that uses the Dates
Less or Equal function to determine whether the date an order is shipped is equal to or
less than the promise date for the order:
6–35
OpenEdge Reporting: Query/Results for Windows
2. Select the calculated field whose name you want to change from the Name drop-down list.
6–36
Analyzing Data
4. Enter the new calculated field name, then choose OK to rename the field and return to the
Properties dialog box.
The field name can be up to 32 characters long and consist of alphabetic characters (A-Z
or a-z), digits (0-9), and special characters ($, &, #, -, and _). In addition, field names must
begin with a letter (a-Z or a-z). The field name must also be unique within the query and
cannot contain spaces.
5. Choose OK.
1. Choose Field→ Add/Remove Fields. The Add/Remove Fields dialog box appears.
2. Select the calculated field you want to remove from the Selected Fields selection list, then
choose Remove.
Aggregate fields
An aggregate field calculates the value of a column of data. For example, you can use an
aggregate value to count the total number of customer orders in a report. Results provides the
following aggregate values:
6–37
OpenEdge Reporting: Query/Results for Windows
Use aggregate values to calculate the value of all the data in the column or to calculate the value
of one or more groups of data within the column, called break groups. When you calculate the
values of all the data in a column, you create an aggregate called a total; when you calculate the
value of a break group, you create a subtotal. The following sections describe totals and
subtotals.
Totals
When you create a total for a particular field, Results calculates the value for the entire column
and places it in the summary area beneath the column at the bottom of the last page of the report.
The following example shows a report that calculates the number of customer orders and the
average price of the items ordered:
Counts the number of customer Calculates the average price of all the
orders and places the result in items ordered and places the result in the
the summary section of the report. summary section of the report.
6–38
Analyzing Data
Subtotals
If you use a sort order to create break groups within the report, you can calculate the subtotal
for each break group. See “Sorting records” section on page 5–7 for information about sorting
with break groups.”
For example, a report that is sorted in ascending order by Cust-Num and descending order by
Order-Num, contains two break groups: one for customers and one for orders. You can use
either the break group associated with Cust-Num or the break group associated with
Order-Num to create subtotals.
Figure 6–12 shows a report that contains a subtotal associated with the Order-Num break
group to calculate the total price for all the items in each order.
Order total
Order total
6–39
OpenEdge Reporting: Query/Results for Windows
The report presented in Figure 6–13 contains an additional subtotal based on the Cust-Num
break group to calculate the total price of all the items each customer ordered. This subtotal
includes all the items in all the orders for each customer.
Total for
order 79
Total for
order 36
Total for
order 6
Total of
orders for
customer 1
As shown in this example, you can use any combination of subtotals for each break group.
You can create an aggregate field based on any database field and on the following types of
calculated fields: Math, String Function, Numeric function, Date Function, and Logical
Function.
6–40
Analyzing Data
• To create a total, select the field for which you want to calculate the total, select
summary line from the Break-By Fields selection list, and select the aggregate value
you want to create.
For example, to count all the orders in the report, select Order-Num from the Query
Fields selection list, select summary line from the Break-By Fields selection list,
then select Count.
• To create a subtotal, select the field for which you want to calculate the subtotal,
select the sort field you want to use from the Break-By Fields selection list, and
select the aggregate value you want to create.
For example, to calculate the total price of the items each customer ordered, select
the Price field from the Query Fields selection list, select the Cust-Num field from
the Break-By Fields selection list, then select Total.
6–41
OpenEdge Reporting: Query/Results for Windows
Figure 6–14 shows a query that does not use Totals Only Summary. In this example, the query
displays the orders for each customer. The query uses the Cust-Num field to sort the orders for
each customer in ascending order. Thus, it contains one break group-a break group for
customers.
6–42
Analyzing Data
As Figure 6–15 shows, the query contains a break group based on the Cust-Num field.
Therfore, you can use Totals Only Summary to calculate and display the combined value of
the Extended-Price field for each set of customer orders.
When you use Totals Only Summary, Results summarizes the information and displays one
record for each group containing the total for the group. Note that when you use Totals Only
Summary the Export view, Results displays the preceding records in the group in addition to
the record containing the total.
6–43
OpenEdge Reporting: Query/Results for Windows
1. Verify that you have at least one break group. If you have more than one break group,
Total Only Summary automatically uses the break group based on the last field in your
sort list to perform the total.
2. Choose Options→ Totals Only Summary. The Totals Only Summary dialog box
appears:
6–44
7
Modifying Display Fields
This chapter describes techniques to modify display fields. Specifically, this chapter presents:
1. Choose Fields→ Add/Remove Fields. Results displays the Add/Remove Fields dialog
box:
• To add a field to the query layout, select the field from the Available Fields selection
list and choose Add or double click on the desired field.
• To remove a field from the query layout, select the field from the Selected Fields
selection list and choose Remove.
3. The fields are listed in the Selected Fields selection list in the order they will be displayed
in the query layout (from left to right). To reorder the fields, select a field and choose either
Move Up or Move Down. Repeat this process until the fields are listed in the order you
want them to appear in the query layout.
7–2
Modifying Display Fields
Property Description
Label Determines the display label assigned to the field. Changing the
Display label for the field does not alter the name of the field
stored in the database.
Format Determines how the data stored in the field is displayed. For
example, display formats indicate how many spaces Results
should put in the display, dollar signs, decimal points, or other
special characters.
Hide Repeating Determines whether Results displays repeating values for the
Values fields. (Results displays repeating values for the fields by
default.)
Column Determines the coordinate location for the field in reports and
forms.
7–3
OpenEdge Reporting: Query/Results for Windows
2. Click the down arrow next to the name field to show the list of display fields included in
the query, then select the display field you want to modify.
3. Change the format, label, and repeating values attributes for the field as follows:
• To change the display format for the field, either type a new format in the Format
field or choose Assistant.
If you choose Assistant, Results displays the Assistant dialog box for the type of
field you are modifying. These types include character, date, decimal, integer, and
logical. See “Changing the format for a display field” section on page 7–5 for more
information about changing display field formats.
• To change the display label, select the existing label and type a new label. The new
label overwrites the old label.
• To change the coordinates where a field is displayed in reports and forms, enter a
numeric value greater than 1 in the Row and Column fields. The numbers you enter
determine the number of rows and columns the field is offset from its current
position. One column is equal to one character space and one row is equal to one line,
where the line is one character high.
7–4
Modifying Display Fields
4. When you are done changing display properties, choose OK in the Properties dialog box
to save your changes.
Note: Any change you make to the display format modifies how the field is displayed.
Changing the display format does not alter how the field is stored in the database.
Figure 7–1 shows the Format dialog box you use to edit character fields.
The format for the field in this example is X(20) where X represents the symbol type for the
field and (20) the maximum length of the field. The symbol X means that the field can display
any type of character. You can modify both the symbol type and maximum length of the field.
7–5
OpenEdge Reporting: Query/Results for Windows
To modify the maximum number of characters the field can display, type a number in the Width
field. To modify the symbol type, choose one of the radio buttons listed in Table 7–2, then
choose OK.
Property Description
Allow letters and numbers only Displays only letters and numbers. Blank spaces are
not allowed.
Allow letters only Displays letters only. Blank spaces are not allowed.
Allow letters and convert to caps Displays capital letters only. Blank spaces are not
allowed.
Allow numbers only Displays numbers only. Blank spaces are not
allowed.
7–6
Modifying Display Fields
The Format field displays the current format for the field. In this example, the format for the
field is 99/99/99. To change the display format for the field, choose one of the radio buttons
listed in Table 7–3, then choose OK.
Property Description
Use the Format dialog box to edit decimal and integer fields:
7–7
OpenEdge Reporting: Query/Results for Windows
The format for the field in this example is ->,>>>,>>9.99, where the dash (-) places a minus sign
in front of the number if the number is negative, or a blank in front of the number if the number
is positive; the greater than signs (>) are replaced with a digit if that digit is not a leading zero,
9 is replaced with a digit, and the period (.) represents a decimal point.
To modify the default display format for the field, change one or more attributes listed in
Table 7–4, then choose OK.
Property Description
Total number of digits Specifies the maximum number of characters the field
can display.
Number of decimal places Specifies the number of decimal places the field can
display.
Use thousand’s separator "," Displays a comma between the thousands and
hundreds columns.
Leading text string: Specifies the text to display before the number.
Trailing text string: Specifies the text to display after the number.
Show leading sign always Always displays a positive (+) or negative (-) sign
before the number.
Show leading sign on negatives Displays a negative (-) sign in front of negative
only numbers only.
Show trailing sign always Always displays a positive (+) or negative (-) sign
after the number.
Show trailing sign on negatives Displays a negative (-) sign after negative numbers
only only.
7–8
Modifying Display Fields
Property Description
Show negatives with trailing Displays the credit symbol (CR) after negative
’CR’ numbers.
Show negatives with trailing Displays the debit symbol (DB) after negative
’DB’ numbers.
Show negatives with trailing Displays the debit symbol (DR) after negative
’DR’ numbers.
Show negatives with trailing ’cr’ Displays the credit symbol (cr) after negative
numbers.
Show negatives with trailing ’db’ Displays the debit symbol (db) after negative
numbers.
Show negatives with trailing ’dr’ Displays the debit symbol (dr) after negative numbers.
Figure 7–2 presents the Format dialog box you use to edit logical fields.
Logical fields can have one of two possible values: TRUE or FALSE. The Format field shows
the terms used to display these values. To change these terms, type a new term in the Display
This When TRUE and Display This When FALSE fields, then choose OK.
7–9
OpenEdge Reporting: Query/Results for Windows
7–10
A
Results Menus
This appendix describes the standard menu options. Specifically, this chapter presents:
• Query menu
• Table menu
• Field menu
• Data menu
• Options menu
• View menu
• Help menu
Note: If your application has been modified, the menu options you have might not be the same
as those discussed in this appendix.
OpenEdge Reporting: Query/Results for Windows
Query menu
The Query menu manipulates queries and exits Results. Table A–1 describes the Query menu.
Generate... Generates 4GL code for the query. (Might be available to the
system administrator only.)
Print Prints a query. You can also use the Print option to save the query
to the Clipboard or to a file.
Site Admin Sets printer options, access limitations, and define table
relationships. (Might be available to the system administrator
only.)
Add/Remove Adds and removes display fields from the query view.
Fields...
Add Calculated Creates a variety of calculated fields to display in the query view.
Field...
Properties Modifies field names, labels, data formats, and coordinates for
the display fields in the query view.
A–2
Results Menus
Table menu
The Table menu manipulates tables. Table A–2 describes the menu that appears when you select
this option.
Field menu
The Field menu creates and manipulates fields. Table A–3 describes the menu that appears
when you select this option.
Add/Remove Adds and removes display fields from the query view.
Fields...
Add Calculated Creates a variety of calculated fields to display in the query view.
Field...
Properties Modifies field names, labels, data formats, and coordinates for
the display fields in the query view.
A–3
OpenEdge Reporting: Query/Results for Windows
Data menu
The Data menu manipulates data. Table A–4 describes the menu that appears when you select
this option.
Selection... Defines the selection criteria Results uses to retrieve records from
the database.
Re-ask Questions... Prompts you to redefine the data selection criteria in the Form
and Browse views.
Sort Ordering... Determines the order in which Results retrieves records from the
database.
Options menu
The Options menu manipulates query and page information. Table A–5 describes the menu that
appears when you select this option.
Query Information... Displays a list containing the tables included in the query, the
display fields used, the sort order for the query, and if you either
printed or viewed a report through print preview, the amount of
time it took to run the query, and the connected databases.
Headers and Creates report headers, footers, cover pages, and final pages.
Footers...
Master-Detail... Sets a break point between the tables used in the Master and
Detail sections of a query.
A–4
Results Menus
Frame Properties... Changes a frames location in the query window and its read-only
status. For Browse views, frame properties changes the number
of rows displayed in the browse at one time.
Standard Page... Selects a predefined label type on which to print the label.
Customer Page... Defines a non-standard page size on which to print the report.
Standard Label... Selects a predefined label type on which to print the label.
Custom Label... Defines a nonstandard label type on which to print the label.
Standard Export... Selects an export data type to export a query to an ASCII file.
View menu
The View menu control in which view Results displays the data and manipulate the screen
layout. Table A–6 describes the menu that appears when you select this option.
A–5
OpenEdge Reporting: Query/Results for Windows
As Export Exports queries to ASCII files that can be incorporated into other
applications.
Tool Bar Displays or hides the tool bar and criteria field.
Help menu
The Help menu provides help information. Table A–7 describes the menu that appears when
you select this option.
Help Topics Choose this option to access the main table of contents, the index,
and the search engine for help information about the specific tool.
Recent Messages Choose this option to display the most recent Progress message
and its description. You can scroll backwards through all
messages since the beginning of your session.
About RESULTS Choose this option to display the version of Progress Results,
copyright date, and system and memory information.
A–6
B
Comparison Operators
You use comparison operators within WHERE clauses to refine the selection criteria for a query.
This appendix presents:
B–2
Comparison Operators
Matches Selects records where the value of Name Matches "Urpon Frisbee"
the tested field matches one or more Selects all the customer records that
characters. Use “wildcard” match the name “Urpon Frisbee.”
characters to extend the range of Name Matches *and*
pattern matching capabilities. Use Selects all the customer records that
an asterisk (*) to match any group of contain the substring “and.”
characters and a period (.) to match Postal-Code Matches 02.10
any single character in the specified Selects records with the Postal-Code
position. field matching 02010, 02110,
02210, 02310, 02410, 02510,
02610, 02710, 02810, and 02910.
B–3
OpenEdge Reporting: Query/Results for Windows
B–4
Index
A B
Adding Bars
display fields 7–2 scroll 3–14
tables to a query 5–2
Break groups 5–9, 6–39
ADE, See Application Development
Environment Browse views 3–3, 4–2
described 2–2
Adjusting report dimensions 4–22 frames 4–4
navigating through records 4–3
Aggregate fields
average 6–37
count 6–37 C
creating 6–37, 6–41
maximum 6–37 Calculated fields
minimum 6–37 counter 6–7, 6–11
subtotal 6–39 creating 6–8
total 6–37, 6–38 date function 6–8, 6–27
described 6–6
Analyzing data 6–1 logical function 6–8, 6–31
lookup 6–7, 6–14
Application Development Environment
math 6–7, 6–17
desktop 2–4 numeric function 6–8, 6–23
Arrays 6–7, 6–12 percent of total 6–7, 6–9
removing 6–37
ASCII files renaming 6–36
generating 4–31 running total 6–7, 6–10
stacked array 6–7, 6–12
Ask At Runtime string function 6–7, 6–20
dialog box 5–19
toggle box 5–14
OpenEdge® Reporting: Query/Results for Windows
Index–2
Index
Expressions
calculated fields 6–7, 6–17 H
Headers 4–17
F
Help
Field menu A–3 menu A–6
Fields
See Display fields I
aggregate, See Aggregate fields
calculated, See Calculated fields Indexes 3–8
character 7–5 compound 1–6
database described 1–6
structure 1–5 simple 1–6
date 7–6
Inner joins, See Relationships, partial
decimal 7–7
described 1–5 Integer fields 7–7
display, See Display fields
integer 7–7
logical 7–9 J
rearranging 4–12
selecting for queries 3–6 Joins, See Relationships
values 6–7, 6–14
Files
ASCII 4–31
L
Filters 5–12 Label types
reformatting 4–28
Footers 4–17 selecting 4–27
Form views 3–3, 4–7 Label views 3–3, 4–24
described 2–2 described 2–2
frames 4–13 reformatting labels 4–28
modifying databases 4–8 selecting label types 4–27
Index–3
OpenEdge® Reporting: Query/Results for Windows
O Q
One-to-many relationships 1–9 Queries 3–2
adding tables 5–2
One-to-many table relationships 3–8 closing 3–12
One-to-one relationships 1–8 creating 3–2
data selection 5–13
Opening queries 3–12 defaults 3–8
deleting 3–16
Operators B–1 described 1–7
frames, See Frames
Options menu A–4 getting information 3–13
opening 3–12
Order, sort printing 3–13
See Sort order relationships 3–9
removing tables 5–2
saving 3–11
Index–4
Index
Index–5
OpenEdge® Reporting: Query/Results for Windows
Views
Table menu A–3
browse 4–2, 4–3
Table relationships 3–8 described 2–2
See Relationships export 4–30
modifying export types 4–33
Tables selecting export types 4–31
adding 5–2 using 4–30
removing 5–2 form 4–7
selecting for queries 3–5 modifying databases 4–8
structure 1–4 navigating through records 4–8
label 4–24
Tool bar 2–6 reformatting labels 4–28
selecting label types 4–27
Totals report 4–16
aggregate fields 6–38 formatting 4–17
running 6–7, 6–10 printing 4–23
totals only summary 6–42 selecting page size 4–21
switching 4–2
W
WHERE clause
creating 5–12
removing 5–19, 5–22
Index–6