home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Product / Product.zip / visquery.zip / FTB89A.INF (.txt) < prev    next >
OS/2 Help File  |  1994-07-12  |  762KB  |  6,410 lines

  1.  
  2. ΓòÉΓòÉΓòÉ 1. Notices ΓòÉΓòÉΓòÉ
  3.  
  4. References in this publication to IBM products, programs, or services do not 
  5. imply that IBM intends to make these available in all countries in which IBM 
  6. operates. Any reference to an IBM product, program, or service is not intended 
  7. to state or imply that only that IBM product, program, or service may be used. 
  8. Any functionally equivalent product, program, or service that does not infringe 
  9. any of IBM's intellectual property rights may be used instead of the IBM 
  10. product, program, or service. The evaluation and verification of operation in 
  11. conjunction with other products, except those expressly designated by IBM, are 
  12. the responsibility of the user. 
  13.  
  14. IBM may have patents or pending patent applications covering subject matter in 
  15. this document. The furnishing of this document does not give you any license to 
  16. these patents. You can send license inquiries, in writing, to: 
  17.  
  18. IBM Corporation
  19. IBM Director of Licensing
  20. 208 Harbor Drive
  21. Stamford, Connecticut 06904-2501
  22. U.S.A.
  23.  
  24.  
  25. ΓòÉΓòÉΓòÉ 1.1. Online publications ΓòÉΓòÉΓòÉ
  26.  
  27. For online information in this book, we authorize you to: 
  28.  
  29. o Copy, modify, and print the documentation contained on the media, for use 
  30.   within your enterprise, provided you reproduce the copyright notice, all 
  31.   warning statements, and other required statements on each copy or partial 
  32.   copy. 
  33.  
  34. o Transfer the original unaltered copy of the documentation when you transfer 
  35.   the related IBM product (which may be either machines you own, or programs, 
  36.   if the program's license terms permit a transfer). You must, at the same 
  37.   time, destroy all other copies of the documentation. 
  38.  
  39. You are responsible for payment of any taxes, including personal property 
  40. taxes, rsulting from this authorization. 
  41.  
  42. THERE ARE NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF 
  43. MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 
  44.  
  45. Some jurisdictions do not allow the exclusion of implied warranties, so the 
  46. above exclusion may not apply to you. 
  47.  
  48. Your failure to comply with the terms above terminates this authorization. Upon 
  49. termination, you must destrioy your machine readable documentation. 
  50.  
  51.  
  52. ΓòÉΓòÉΓòÉ 1.2. Examples ΓòÉΓòÉΓòÉ
  53.  
  54. This publication contains examples of data and windows used in daily business 
  55. operations. They are intended only to be illustrative of the types of functions 
  56. available in QUERY FOR OS/2 and may contain the names of individuals, 
  57. companies, brands, and products. All of these names are fictitious, and any 
  58. similarity to the names and addresses used by an actual business enterprise is 
  59. entirely coincidental. Windows shown in this publication are intended to be 
  60. examples and may not be exact representations of actual windows. 
  61.  
  62.  
  63. ΓòÉΓòÉΓòÉ 1.3. Trademarks and service marks ΓòÉΓòÉΓòÉ
  64.  
  65. The following terms, denoted by an asterisk (*), used in this publication, are 
  66. trademarks or service marks of IBM Corporation in the United States of America 
  67. or other countries: 
  68.  
  69. AIX                                               OS/2 
  70. AIX/6000                                          OS/400 
  71. Application System/400                            Presentation Manager 
  72. AS/400                                            PS/2 
  73. DATABASE 2                                        QMF 
  74. DB2                                               SQL/400 
  75. DB2/2                                             SQL/DS 
  76. DB2/6000                                          Systems Application 
  77.                                                   Architecture 
  78. Extended Services                                 Ultimedia 
  79. IBM                                               Workplace Shell 
  80. Operating System/400 
  81.  
  82.  
  83. ΓòÉΓòÉΓòÉ 2. About this book ΓòÉΓòÉΓòÉ
  84.  
  85. This book describes the main features of IBM* Visualizer Query for OS/2 
  86. (referred to as QUERY FOR OS/2). It includes this preface, three parts, 
  87. appendixes, a bibliography, and an index. 
  88.  
  89. The preface covers assumptions about your: 
  90.  
  91. Hardware                                          Database authorizations 
  92. Software                                          Structured Query Language 
  93.                                                   (SQL) knowledge 
  94. OS/2* knowledge 
  95.  
  96. Part 1, Introducing Query for OS/2, describes QUERY FOR OS/2 and additional 
  97. Visualizer products that you can add to it. 
  98.  
  99. Producing hands-on information with Query for OS/2 describes some tasks you can 
  100. do with QUERY FOR OS/2. 
  101.  
  102. Welcome to Query for OS/2 shows you what you get when QUERY FOR OS/2 is 
  103. installed. 
  104.  
  105. Extending Visualizer Query for OS/2 describes products you can add to QUERY FOR 
  106. OS/2 to improve and enhance the way you work with and present data. 
  107.  
  108. Part 2, Visualizing data, shows you how to access existing data, query it, and 
  109. present it without using SQL. 
  110.  
  111. Looking at and creating SQL tables describes how to access and work with the 
  112. data you currently use, and how to create and store new tables in your 
  113. database. 
  114.  
  115. Looking at and creating SQL views covers how you can work with views in your 
  116. database, and how to combine data from many tables into a single view. 
  117.  
  118. Selecting and combining data using queries details how to use Visualizer 
  119. queries that have been created for you, and how to create a simple query of 
  120. your own. 
  121.  
  122. Retrieving and manipulating data using queries provides information on using 
  123. Visualizer's powerful features to create and run complex queries. 
  124.  
  125. Accessing data using SQL Statements describes how to use an SQL Statement to 
  126. retrieve data. 
  127.  
  128. Analyzing and presenting data using reports gives details on analyzing and 
  129. presenting data in a report. 
  130.  
  131. Choosing the best report for your data describes how to create the best report 
  132. for your data. 
  133.  
  134. Defining and working with Visualizer tables shows you how to work with 
  135. Visualizer tables. 
  136.  
  137. Part 3, Accessing and maintaining data with Query for OS/2, describes how to 
  138. bring your database to your desktop and maintain the data in it. Some of the 
  139. tasks in this part require a basic understanding of SQL. 
  140.  
  141. Accessing SQL databases describes how to access remote and local databases, and 
  142. how to display the tables and views in those databases. 
  143.  
  144. Improving data integrity, performance, and security covers how you can improve 
  145. the integrity, performance, and security of your tables and views. 
  146.  
  147. Creating effective SQL statements shows you how to define SQL Statements for 
  148. use by others. 
  149.  
  150. The appendixes provide information on customizing QUERY FOR OS/2 objects, 
  151. running objects from the OS/2 command line, creating and renaming new objects, 
  152. and using QMF* forms with QUERY FOR OS/2. 
  153.  
  154.  
  155. ΓòÉΓòÉΓòÉ 3. Before you start... ΓòÉΓòÉΓòÉ
  156.  
  157. Before you begin using QUERY FOR OS/2, make sure your workstation meets the 
  158. minimum hardware and memory requirements outlined on the Query for OS/2 Quick 
  159. Install Card. Also, OS/2 Version 2.1 (or later) and QUERY FOR OS/2 should be 
  160. installed on your IBM PS/2* or IBM-compatible workstation. To use non-product 
  161. data, we recommend you install DATABASE 2* OS/2 (DB2/2*) Version 1.1 (or 
  162. later). 
  163.  
  164. You should know the names of the SQL databases, SQL tables, and SQL views you 
  165. are authorized to use, and have some knowledge of the database you are working 
  166. with. If you do not know the names of the objects you can use, if you need 
  167. additional authorizations, or if you need more information about your database, 
  168. see your database administrator. 
  169.  
  170. Using SQL View and SQL Statement objects requires that you have a basic 
  171. understanding of SQL. For more information, see the SQL reference for your 
  172. database. 
  173.  
  174. You should be familiar with OS/2 and be able to perform the following tasks: 
  175.  
  176. Drag and drop objects                             Copy and paste objects 
  177. Open and close windows                            Create shadows of objects 
  178. Print objects                                     Display a pop-up menu 
  179. Delete objects                                    Access online help 
  180. Move objects                                      Open a notebook and change an 
  181.                                                   object's settings 
  182.  
  183. You can find basic information about OS/2 by opening the Information folder in 
  184. the OS/2 System folder on your desktop. You can then view the following OS/2 
  185. information: 
  186.  
  187. Master Help Index                                 Command Reference 
  188. Glossary                                          Tutorial 
  189.  
  190.  
  191. ΓòÉΓòÉΓòÉ 4. Producing hands-on information with Query for OS/2 ΓòÉΓòÉΓòÉ
  192.  
  193. The best way to understand how QUERY FOR OS/2 can help you produce timely, 
  194. useful information is to see it in action. So before you learn about the 
  195. individual parts of QUERY FOR OS/2, here is an example of how one person solved 
  196. a business problem using QUERY FOR OS/2. 
  197.  
  198.  
  199. ΓòÉΓòÉΓòÉ 4.1. Show me where my business is doing well ΓòÉΓòÉΓòÉ
  200.  
  201. Alan Bryant is a regional manager for an international credit card company. 
  202. Each month Alan needs to produce a listing that shows the stores in his region 
  203. where his company's card is used most. He has to deliver this information to 
  204. many people, so he decides to create a "success report". 
  205.  
  206. The information Alan needs is stored in a remote database, so he creates an SQL 
  207. database on his desktop and filters it to show only those tables that contain 
  208. information about his region. 
  209.  
  210. Alan only wants to use a couple of tables from the database: one table contains 
  211. details of transactions at stores in his region, using a code for each store; 
  212. the other identifies each store name by using the store codes. By dragging 
  213. these tables to a query and linking them, Alan can access the data he wants for 
  214. his report-store names and the number of transactions at each store. 
  215.  
  216. Now, Alan drops this query onto a report to see all the stores in his area that 
  217. accept his company's card. The report lists the stores in descending order 
  218. based on the number of transactions at each store. Alan customizes his report 
  219. to look just the way he wants it, using fonts, colors, and headings, then mails 
  220. the report electronically to everyone on his distribution list. 
  221.  
  222. The query is rerun whenever the report is opened, so everyone who has a copy of 
  223. the report also has the most up-to-date information at their fingertips. 
  224.  
  225.  
  226. ΓòÉΓòÉΓòÉ 4.2. How did he do that? ΓòÉΓòÉΓòÉ
  227.  
  228. Alan just created a document that provides the right information to the right 
  229. people whenever they need to see it, without ever stepping away from his desk. 
  230. You can do this same thing using QUERY FOR OS/2. To find information on the 
  231. different objects 
  232.  
  233. To do this:                                                 See: 
  234. Create an SQL database and display its contents             Accessing SQL 
  235.                                                             databases 
  236. Use SQL tables in a database, or create new ones            Looking at and 
  237.                                                             creating SQL tables 
  238. Create queries without using SQL                            Selecting and 
  239.                                                             combining data 
  240.                                                             using queries and 
  241.                                                             Retrieving and 
  242.                                                             manipulating data 
  243.                                                             using queries 
  244. Create and tailor a report                                  Analyzing and 
  245.                                                             presenting data 
  246.                                                             using reports and 
  247.                                                             Choosing the best 
  248.                                                             report for your 
  249.                                                             data 
  250. Keep reports up-to-date by linking objects                  Choosing the best 
  251.                                                             report for your 
  252.                                                             data 
  253.  
  254. QUERY FOR OS/2 contains some other objects that Alan could have used in the 
  255. preceding example to speed up his work even more. 
  256.  
  257. o To use a view to combine information from the tables in your query, see 
  258.   Looking at and creating SQL views 
  259.  
  260. o To store the data from the query in a Visualizer table and take it when you 
  261.   visit the stores in your region, see Defining and working with Visualizer 
  262.   tables 
  263.  
  264. o To write an SQL Statement (instead of using a Visualizer query) as input for 
  265.   your report, see Accessing data using SQL Statements 
  266.  
  267.  
  268. ΓòÉΓòÉΓòÉ 5. Welcome to Query for OS/2 ΓòÉΓòÉΓòÉ
  269.  
  270. Start visualizing your data with IBM Visualizer Query for OS/2, a workstation 
  271. query and presentation tool for database users. QUERY FOR OS/2 uses a simple 
  272. graphical interface so you can improve the way you do business without needing 
  273. detailed knowledge of databases or SQL. QUERY FOR OS/2 provides access to a 
  274. wide range of databases, so you can get to your corporate, departmental, or 
  275. personal data and do your job faster and more efficiently. 
  276.  
  277. QUERY FOR OS/2 is incorporated into OS/2's desktop interface, so you can do 
  278. your work by using icons on your workstation screen that represent objects you 
  279. already use in your day-to-day activities. 
  280.  
  281. The SQL Table, Query, and Report icons on your screen represent actual tables, 
  282. queries, and reports. This means you can query your data and create reports 
  283. without using difficult syntax or learning complex commands. For example, you 
  284. can: 
  285.  
  286. o Print a report by simply dragging its icon to a printer icon. 
  287.  
  288. o Query data in several tables by dragging the small icons for the tables to an 
  289.   open query. 
  290.  
  291. o Update data by opening a table icon and typing over the existing data. 
  292.  
  293. o Keep a report constantly up-to-date by linking it to a query-whenever you 
  294.   open the report, the linked query runs again and updates the report with the 
  295.   latest information. 
  296.  
  297. With QUERY FOR OS/2, you can do your work faster by moving, copying, or linking 
  298. objects on the screen. When you open any QUERY FOR OS/2 object, you can do 
  299. everything by pointing and selecting with your mouse. There is a convenient 
  300. tool bar for things you do often. And QUERY FOR OS/2 also includes extensive 
  301. online documentation to help you with the wide variety of tasks you may want to 
  302. perform. 
  303.  
  304. QUERY FOR OS/2 provides a set of integrated objects representing a wide variety 
  305. of information, so you can organize and do your work in ways that suit you. 
  306.  
  307. Access the contents of a relational database from your desktop with Visualizer 
  308. SQL Database. You can view its contents, submit SQL, or access other databases. 
  309.  
  310. View or change the structure or data of a table in a database with Visualizer 
  311. SQL Table. 
  312.  
  313. Look at a view in a database or combine data from SQL tables with Visualizer 
  314. SQL View. You can also create a new SQL view using an existing SQL view. 
  315.  
  316. Keep working when you're away from your database or using a laptop computer 
  317. with Visualizer Table. You can import data into Visualizer tables, export data 
  318. from Visualizer tables, or create new SQL tables by dropping Visualizer tables 
  319. into an SQL database. 
  320.  
  321. Join, select, and summarize data in SQL tables, SQL views, and Visualizer 
  322. tables with Visualizer Query. 
  323.  
  324. Create, store, and run queries with Visualizer SQL Statement. Users with little 
  325. or no SQL knowledge can use SQL Statements that are already created for them, 
  326. and users familiar with SQL can create complex queries quickly. 
  327.  
  328. Present your data using fonts and colors with Visualizer Report. Your report 
  329. can use data from SQL tables, SQL views, queries, Visualizer tables, and SQL 
  330. Statements. 
  331.  
  332.  
  333. ΓòÉΓòÉΓòÉ 5.1. The Visualizer folder ΓòÉΓòÉΓòÉ
  334.  
  335. All the tools that you need to start using QUERY FOR OS/2 are in the Visualizer 
  336. folder, which is displayed on your desktop when you install QUERY FOR OS/2. 
  337. When you open the folder, you'll see something like this: 
  338.  
  339. When you install QUERY FOR OS/2, an SQL database object is created for each 
  340. database cataloged in DB2/2. These objects help you work with your data quickly 
  341. and easily. When you open an SQL Database object, the tables and views you can 
  342. work with are displayed. Your data is at your fingertips-just click the mouse a 
  343. few times and your data is displayed on your screen. 
  344.  
  345. The SQL Database object can retrieve data from the following database managers: 
  346.  
  347. DB2/2                                             DB2/VM (SQL/DS*) 
  348. DB2/6000*                                         DB2/VSE (SQL/DS) 
  349. DB2* on MVS                                       AS/400* Database 
  350.  
  351. The other folders and objects in the Visualizer folder are described below: 
  352.  
  353. Start Here provides an overview and scenarios showing how to use QUERY FOR OS/2 
  354. "in the real world". 
  355.  
  356. You can find tutorials that help you start using QUERY FOR OS/2 immediately in 
  357. the Tutorials folder. 
  358.  
  359. A folder holds samples of QUERY FOR OS/2 objects, showing you how you might use 
  360. them in your organization. 
  361.  
  362. A folder contains online versions of the product manuals. 
  363.  
  364. The Profile maintains settings used by all QUERY FOR OS/2 objects. These 
  365. settings include time, date, and language. 
  366.  
  367. This object, found in the Utilities folder, helps you maintain QUERY FOR OS/2, 
  368. install new versions of QUERY FOR OS/2, or delete QUERY FOR OS/2 from your 
  369. workstation. 
  370.  
  371. This tool, which is also in the Utilities folder, binds databases that you 
  372. catalog after installing QUERY FOR OS/2. 
  373.  
  374. A folder contains templates of the QUERY FOR OS/2 objects. The original 
  375. templates are located in the OS/2 Templates folder. 
  376.  
  377.  
  378. ΓòÉΓòÉΓòÉ 5.2. Query for OS/2 templates ΓòÉΓòÉΓòÉ
  379.  
  380. The Shadows of Templates folder contains templates for each of the objects. You 
  381. can create these objects by dragging and dropping them onto a folder or SQL 
  382. database. 
  383.  
  384. Common OS/2 tasks gives details on creating and renaming objects. 
  385.  
  386.  
  387. ΓòÉΓòÉΓòÉ 5.3. Query for OS/2 online help ΓòÉΓòÉΓòÉ
  388.  
  389. Comprehensive online help is available from every window in QUERY FOR OS/2. To 
  390. get online help, do one of the following: 
  391.  
  392. o Press function key 1 (F1) for help on a selected object, an active window, or 
  393.   a highlighted choice in a menu. 
  394.  
  395. o Select the Help push button in a QUERY FOR OS/2 window. 
  396.  
  397. o Select a choice from the Help menu. 
  398.  
  399. o Select from the tool bar. 
  400.  
  401.  
  402. ΓòÉΓòÉΓòÉ 6. Extending Visualizer Query for OS/2 ΓòÉΓòÉΓòÉ
  403.  
  404. QUERY FOR OS/2 is at the heart of the IBM Visualizer family of products. If you 
  405. use QUERY FOR OS/2 to access and query your data, you can also use it as a 
  406. foundation for a wide range of tools, or as a companion to other products, that 
  407. improve the way you do business. 
  408.  
  409. To order any of these products, please contact your IBM representative. If you 
  410. would like more information about Visualizer products, please use the form at 
  411. the back of this book. 
  412.  
  413.  
  414. ΓòÉΓòÉΓòÉ 6.1. The Visualizer suite of products ΓòÉΓòÉΓòÉ
  415.  
  416. Improve the way you see your data even more with the Visualizer suite of 
  417. products. All of these products are designed to work together on your OS/2 
  418. desktop. The publications listed on the back cover of this book provide more 
  419. information about each product. 
  420.  
  421. Visualizer Charts for OS/2
  422. Present and interpret your business data visually with a variety of charting 
  423. and presentation options. Use Charts for OS/2 to graphically display trends, 
  424. compare figures, and highlight information. 
  425.  
  426. Visualizer Development for OS/2
  427. Development for OS/2 provides a comprehensive set of programming tools 
  428. specifically designed to help you develop decision-support applications. Use 
  429. Development's four components-the Menu editor, Window editor, Program editor, 
  430. and the Make facility-to design, prototype, and build applications that meet 
  431. your company's needs. 
  432.  
  433. Visualizer Plans for OS/2
  434. Project, analyze, measure, and control many aspects of your business with Plans 
  435. for OS/2, a flexible, multi-dimensional planning tool. In addition to plan 
  436. items and time, you can also define up to four dimensions for your plan to help 
  437. you solve your business and organizational problems. 
  438.  
  439. Visualizer Procedures for OS/2
  440. Automate the jobs that you do regularly by creating, maintaining, and running 
  441. programs with Procedure for OS/2. You can speed up your work by using Procedure 
  442. for OS/2 to do some tasks for you while you do others. 
  443.  
  444. Visualizer Statistics for OS/2
  445. Understand your business data using professional statistical methods provided 
  446. by Statistics for OS/2. You can choose from over 55 methods, ranging from 
  447. simple tests and regressions to model fittings and ANOVA. Statistics for OS/2 
  448. provides interfaces to help both the novice and experienced user analyze data 
  449. with minimum effort. 
  450.  
  451. Visualizer Ultimedia* Query for OS/2
  452. Store, find, hear, and see multimedia data in a relational database with 
  453. Ultimedia Query for OS/2. Store traditional data, like numbers and text, with 
  454. related images, video, audio, and documents. Sort and find images by color, 
  455. shape, texture, or layout by telling Ultimedia Query for OS/2 to "find 
  456. something that looks like this". When you find the images, just click on them 
  457. to display the image, play the video, or hear the audio recording. 
  458.  
  459.  
  460. ΓòÉΓòÉΓòÉ 6.2. Companion products ΓòÉΓòÉΓòÉ
  461.  
  462. Use the following products with Visualizer to open up your world of 
  463. information. 
  464.  
  465. DataGuide/2
  466. Use DataGuide/2 to manage your OS/2 objects, including Visualizer objects. 
  467. DataGuide/2 provides a single place for accessing information. You can search 
  468. for information using keywords, values, and information types, then launch 
  469. applications immediately so you can work with your data instantly. 
  470.  
  471. Query Manager (QM) and Query Management Facility (QMF)
  472. Integrate the versatility of Visualizer with the reliability you've come to 
  473. trust in solutions like QM and QMF. Create Visualizer queries, SQL Statements, 
  474. and reports from QM queries and forms, or bring your existing QMF data to the 
  475. desktop by turning QMF forms into Visualizer reports. 
  476.  
  477.  
  478. ΓòÉΓòÉΓòÉ 6.3. Visualizer education ΓòÉΓòÉΓòÉ
  479.  
  480. Some of the examples used in this book were taken from Visualizer educational 
  481. material. 
  482.  
  483. If you would like details about Visualizer Education, please use the form at 
  484. the back of this book. 
  485.  
  486.  
  487. ΓòÉΓòÉΓòÉ 7. Looking at and creating SQL tables ΓòÉΓòÉΓòÉ
  488.  
  489. Use an SQL Table object to organize, access, and maintain data stored in 
  490. databases. You can use SQL tables to display and work with data that you 
  491. already use in your daily activities, and to create new tables in a database, 
  492. without using SQL at all. 
  493.  
  494. Use the Visualizer Table object to work with data when you are not connected to 
  495. a database, or when you are using QUERY FOR OS/2 on a laptop computer. 
  496.  
  497. You can drag and drop tables onto the following objects: 
  498.  
  499. o SQL Database 
  500. o Visualizer query 
  501. o Visualizer report 
  502. o Printer 
  503. o Shredder 
  504.  
  505. You can open a table to browse and update data. You can also change the table's 
  506. definition by adding columns and by updating the comments that describe the 
  507. table and its columns. 
  508.  
  509. The definition of an SQL table consists of the alias of the database that the 
  510. table is stored in, a description of the table, and the attributes of each 
  511. column in the table. Column attributes are name, description, data type, size, 
  512. and position. 
  513.  
  514. This chapter shows you how to look at and work with data, how to add columns, 
  515. and how to create new SQL tables. 
  516.  
  517.  
  518. ΓòÉΓòÉΓòÉ 7.1. Viewing and updating data in an SQL table ΓòÉΓòÉΓòÉ
  519.  
  520. When you catalog an existing database, the tables in that database are 
  521. available for you to work with. You might need to update, add, or delete 
  522. information in a table. 
  523.  
  524. To display data in a table, open the table you want to work with. 
  525.  
  526. The data is displayed in rows and columns, or as a table view This is the 
  527. default. 
  528.  
  529. The table is in browse mode, which means that you cannot change the data or add 
  530. new data to the table. 
  531.  
  532. The information area at the bottom of the window displays certain information 
  533. about the table: 
  534.  
  535. o The number of rows retrieved (fetched) from the database. 
  536.  
  537. o The maximum number of rows that can be retrieved from the database (the fetch 
  538.   limit). 
  539.  
  540. The fetch limit is one of a number of settings that affect how you access and 
  541. view data. You can define these settings in the Profile notebook. They include: 
  542.  
  543. o The fetch limit 
  544.  
  545. o The time limit before the displayed data is rolled back to its last saved 
  546.   state 
  547.  
  548. o The type of locking used when an SQL table is displayed 
  549.  
  550. o Whether you have exclusive access to data when you display it or if another 
  551.   user can also access the data 
  552.  
  553. See Customizing Query for OS/2 objects for more information on these settings. 
  554.  
  555. You can also browse a table as a form by selecting from the tool bar. A form 
  556. shows one row of data at a time. 
  557.  
  558. To browse each row of the table, use the Next and Previous push buttons at the 
  559. bottom of the window. 
  560.  
  561. Switch back to the table view by selecting from the tool bar. 
  562.  
  563.  
  564. ΓòÉΓòÉΓòÉ 7.1.1. Browsing data ΓòÉΓòÉΓòÉ
  565.  
  566. When you browse data in the table view, you can: 
  567.  
  568. o Change the display width of the columns 
  569. o Anchor columns so they remain on the screen when you scroll 
  570. o Display a subset of the data 
  571. o Select the columns and rows that are displayed 
  572. o Display rows of data in a specified order 
  573.  
  574.  
  575. ΓòÉΓòÉΓòÉ 7.1.1.1. Changing the display width of a column ΓòÉΓòÉΓòÉ
  576.  
  577. When you display data in a table, the columns are shown at a default width. The 
  578. actual length of the data in the column might be less or greater than this 
  579. width. You can change the width of the columns displayed on the screen by 
  580. dragging a column separator to the left or right. A column separator is a line 
  581. shown between the columns in the table view. 
  582.  
  583. Moving the separator only changes the number of characters that are displayed, 
  584. not the number of characters the column can contain. For example, you can drag 
  585. a column separator so that only one character in the column is displayed, 
  586. although the column can contain up to thirty characters. 
  587.  
  588.  
  589. ΓòÉΓòÉΓòÉ 7.1.1.2. Anchoring columns ΓòÉΓòÉΓòÉ
  590.  
  591. When there are many columns in a table, you can lose track of the relationship 
  592. between the columns as you scroll across a table. To provide a point of 
  593. reference, you can anchor columns on the lefthand side of the table. These 
  594. columns stay in place as you scroll across the data. 
  595.  
  596. To anchor columns: 
  597.  
  598.  1. Select from the tool bar. The Fix columns window is displayed. 
  599.  
  600.  2. Select the columns you want to anchor from the Columns list. 
  601.  
  602.  3. Select OK. 
  603.  
  604.  
  605. ΓòÉΓòÉΓòÉ 7.1.1.3. Displaying a subset of columns in a table ΓòÉΓòÉΓòÉ
  606.  
  607. After you display a table, you might want to work with only a few columns at a 
  608. time. You can do this by displaying a subset of the columns in the table. The 
  609. columns that are not included in the subset are "hidden", but they are still 
  610. available. 
  611.  
  612. To select a subset of columns: 
  613.  
  614.  1. From the View menu, select Subset columns. The Subset columns window is 
  615.     displayed, listing the columns in the table. 
  616.  
  617.  2. Select the columns you want to include in the subset. 
  618.  
  619.  3. Select OK. 
  620.  
  621. The columns you selected are now displayed. To change the subset, return to the 
  622. Subset columns window, select or deselect columns, then select OK. To redisplay 
  623. all columns, return to the Subset columns window, select Deselect all, then 
  624. select OK. 
  625.  
  626.  
  627. ΓòÉΓòÉΓòÉ 7.1.1.4. Selecting columns and rows for display ΓòÉΓòÉΓòÉ
  628.  
  629. When you display a table, all the columns in it are displayed. To work with a 
  630. specific, more manageable amount of data, you can select just some of the 
  631. columns in the table from the database, or just some of the rows. 
  632.  
  633. Each time you select columns or rows, the database is reaccessed, and a new set 
  634. of data is retrieved. 
  635.  
  636. To select columns: 
  637.  
  638.  1. Select from the tool bar. The Select Columns window is displayed, listing 
  639.     all the columns in the table. Because the entire table is displayed 
  640.     currently, every column in the Select Columns window is selected. 
  641.  
  642.  2. Deselect the columns you do not want to display, leaving those columns you 
  643.     want displayed selected. The number to the left of each column name 
  644.     indicates the position of the column when it is displayed. 
  645.  
  646.  3. Select OK to confirm your column selection. The new set of data is 
  647.     retrieved from the database and displayed. 
  648.  
  649. To select rows: 
  650.  
  651.  1. Select from the tool bar. The Select rows window is displayed. 
  652.  
  653.  2. Enter an expression that specifies the rows you want to display. For 
  654.     example, to display rows only for those employees who earn over $27,000 a 
  655.     year, type SALARY>27000 
  656.  
  657.     If you're not sure how to enter the expression, select for help in building 
  658.     the expression. See Building an expression for more information on building 
  659.     expressions. 
  660.  
  661.  3. Select OK. The rows that match your selection criteria are retrieved from 
  662.     the database and displayed. 
  663.  
  664.  
  665. ΓòÉΓòÉΓòÉ 7.1.1.5. Ordering rows within a table ΓòÉΓòÉΓòÉ
  666.  
  667. You might want to organize data in a column in a particular order. For example, 
  668. you might want to display the employees in your department by salary (highest 
  669. to lowest). To do this, you can order the rows within a table: 
  670.  
  671.  1. Select from the tool bar. The Order rows window is displayed. 
  672.  
  673.  2. Select a column from the Available columns list, then select a sorting 
  674.     order. Select Ascending to order the rows from lowest to highest (for 
  675.     example, 1 to 9), or Descending to order the rows from highest to lowest 
  676.     (for example, 9 to 1). 
  677.  
  678.  3. Select Add to add the column to the Column list. The Order column displays 
  679.      to indicate ascending order and  to indicate descending order. 
  680.  
  681.  4. Repeat steps 2 and 3 to order the table even more. 
  682.  
  683.  5. Select OK. The table is redisplayed using the ordering criteria you 
  684.     specified. 
  685.  
  686.  
  687. ΓòÉΓòÉΓòÉ 7.1.2. Updating data ΓòÉΓòÉΓòÉ
  688.  
  689. You can update data in both the form and table views. Select to switch from 
  690. browse mode to update mode. 
  691.  
  692. The table must have a primary key defined before you can update it. If no 
  693. primary key is defined, the Specify key for update window is displayed when you 
  694. enter update mode so you can set a temporary key. 
  695.  
  696. The temporary key is not part of the table, and is not saved when you close or 
  697. save the table. 
  698.  
  699. To set a temporary key: 
  700.  
  701.  1. In the Specify key for update window, select the column or columns to be 
  702.     included in the key. The column or combination of columns you select must 
  703.     uniquely identify each row in the table. 
  704.  
  705.  2. Select OK. 
  706.  
  707. You can now update the data and the structure of the table. 
  708.  
  709. You can change the temporary key by selecting to display the Specify key for 
  710. update window and modifying the current selections. 
  711.  
  712.  
  713. ΓòÉΓòÉΓòÉ 7.1.2.1. Working with the table view ΓòÉΓòÉΓòÉ
  714.  
  715. When you display data as a table, you use handles to select the columns, rows, 
  716. and cells. Handles appear above columns and to the left of rows and cells. 
  717.  
  718. You can select columns, rows, and cells in several ways: 
  719.  
  720. o To select a single column, row, or cell, select its handle. 
  721.  
  722. o To select more than one column, row, or cell, select a handle, then select 
  723.   other handles while holding the Ctrl key. 
  724.  
  725. o To select a contiguous range of columns, rows, or cells, select the first 
  726.   handle in the range, then select the last handle in the range while holding 
  727.   down the Shift key. 
  728.  
  729. To move between cells in a row, press the Tab key. To move to the next row, 
  730. press Enter. 
  731.  
  732.  
  733. ΓòÉΓòÉΓòÉ 7.1.2.2. Working with the form view ΓòÉΓòÉΓòÉ
  734.  
  735. When using the form view, you display and work with your data by using the push 
  736. buttons at the bottom of the window: 
  737.  
  738. Next           Displays the next row. 
  739. Previous       Displays the previous row. 
  740. Add            Adds a new row containing the currently displayed data. 
  741. Delete         Removes the current row and its data from the table. 
  742. Clear          Inserts a new, blank row into the table. 
  743. Reset          Restores any changes you made to the current row back to their 
  744.                original values. 
  745.  
  746.  
  747. ΓòÉΓòÉΓòÉ 7.1.2.3. Adding rows and data to a table ΓòÉΓòÉΓòÉ
  748.  
  749. If you are working with the table view, you can add a new row by selecting from 
  750. the tool bar. Then, you can enter new data into the row. 
  751.  
  752. If you are working with the form view, you can add a new row in two ways. 
  753.  
  754. o To add a new row that contains data similar to a row already in the table, 
  755.   change the data that is different and select Add. A new row with the updated 
  756.   data is added to the table. 
  757.  
  758. o To add a new, blank row to the table, select Clear. Type the new data into 
  759.   the blank row, and select Add. 
  760.  
  761. To move between cells, press the Tab key. 
  762.  
  763.  
  764. ΓòÉΓòÉΓòÉ 7.1.2.4. Deleting rows ΓòÉΓòÉΓòÉ
  765.  
  766. You can delete rows that are no longer needed in a table. In the table view, 
  767. select the row or rows you want to delete, then select Delete from the Edit 
  768. menu. In the form view, select the Delete button to delete the currently 
  769. displayed row. 
  770.  
  771.  
  772. ΓòÉΓòÉΓòÉ 7.2. Changing an existing SQL table ΓòÉΓòÉΓòÉ
  773.  
  774. You might want to change an existing SQL table by adding columns or by 
  775. modifying the comments that describe an SQL table and its columns. 
  776.  
  777.  
  778. ΓòÉΓòÉΓòÉ 7.2.1. Adding columns to an SQL table ΓòÉΓòÉΓòÉ
  779.  
  780.  1. Open the notebook. 
  781.  
  782.  2. On the Columns page, type the name of the column in the Name field. 
  783.  
  784.  3. Type a brief comment describing the column in the Comment field. 
  785.  
  786.  4. Select a data type from the Data Type list. 
  787.  
  788.  5. Depending on data type selected, use the Precision and Scale fields or the 
  789.     Width field to specify the maximum number of characters the column can 
  790.     contain. 
  791.  
  792.  6. Select a button under Allow Nulls? to indicate if null values (blanks in 
  793.     the databases) can be included in the column. In some databases, you can 
  794.     use the default for the specified data type. 
  795.  
  796.  7. Select Add. The information you just entered is shown in the Column List. 
  797.     The column name is enclosed in brackets, indicating that the column has not 
  798.     been applied to the database. When the column is applied, the brackets are 
  799.     removed. 
  800.  
  801.  8. Select Clear to clear the entry fields. 
  802.  
  803.  9. Repeat steps 2 through 8 for each column in the SQL table. 
  804.  
  805. 10. Select Apply all on the Table page to apply the changes to the database, 
  806.     and close the notebook. 
  807.  
  808.  
  809. ΓòÉΓòÉΓòÉ 7.2.2. Modifying comments for an SQL table and its columns ΓòÉΓòÉΓòÉ
  810.  
  811. You can update or delete comments from an SQL table that exists in a database. 
  812.  
  813. To update a comment for an SQL table: 
  814.  
  815.  1. Open the notebook. On the Table page, the current comment for the SQL table 
  816.     (if any) is displayed in the Comment field. 
  817.  
  818.  2. Update or delete the comment in the Comment field. 
  819.  
  820.    o Edit the comment or, if no comment exists, type a new one. 
  821.    o Highlight the comment and press the Delete key on your keyboard. 
  822.  
  823.  3. Select Apply all to apply the new comment to the database, and close the 
  824.     notebook. 
  825.  
  826. To update a comment for a column: 
  827.  
  828.  1. Open the notebook. 
  829.  
  830.  2. On the Columns page select, from the Column List, the column name that 
  831.     contains the comment you want to update. The information for the selected 
  832.     column is displayed in the fields in the Column name and definition area. 
  833.  
  834.  3. Update or delete the comment displayed in the Comment field: 
  835.  
  836.    o Edit the current comment or type a new one. 
  837.    o Highlight the comment and press the Delete key on your keyboard. 
  838.  
  839.  4. Select Modify. 
  840.  
  841.  5. Repeat steps 2, 3, and 4 for each comment you want to update. 
  842.  
  843.  6. Select Apply all on the Table page to apply the changes to the database, 
  844.     and close the notebook. 
  845.  
  846.  
  847. ΓòÉΓòÉΓòÉ 7.3. Creating new SQL tables ΓòÉΓòÉΓòÉ
  848.  
  849. You can create new SQL tables from existing SQL tables, from an SQL table 
  850. designated as a template, or from the SQL Table template object in the 
  851. Visualizer folder. After you create the new table, you can display it and add 
  852. data to it. See Viewing and updating data in an SQL table for information on 
  853. adding data to an SQL table. 
  854.  
  855.  
  856. ΓòÉΓòÉΓòÉ 7.3.1. Creating a new SQL table based on an existing SQL table ΓòÉΓòÉΓòÉ
  857.  
  858. You might want to create a new SQL table with the same column attributes as an 
  859. SQL table that already exists in an SQL database, but without the same data. 
  860. You might do this for tables that contain the same type of information (for 
  861. example, product names, product numbers, quantity sold, and cost for a 
  862. particular month), but not the same data. 
  863.  
  864. If you need to do this only once, you can create a new SQL table with the same 
  865. definition as an existing SQL table by using the Create from menu choice. 
  866.  
  867. If you want to create several SQL tables based on a single definition, you can 
  868. create a template with a specific definition. See Common OS/2 tasks for 
  869. information on how to do this. 
  870.  
  871. Before you apply a new SQL table to the database, you can change any 
  872. information in the SQL table. After you apply the SQL table to a database, you 
  873. can modify only the comments for the SQL table and for the columns in the SQL 
  874. table. See Modifying comments for an SQL table and its columns for more 
  875. information. 
  876.  
  877. To create a new SQL table from an existing SQL table definition: 
  878.  
  879.  1. Locate the existing SQL table you want to use. 
  880.  2. Ensure that all changes to the existing SQL table are applied to the 
  881.     database. 
  882.  3. Display the pop-up menu for the SQL table. 
  883.  4. Select Create from. An icon for the new SQL table is displayed. 
  884.  5. Open the notebook for the new SQL table. 
  885.  6. Modify the information for the SQL table or its columns. This step is 
  886.     optional. 
  887.  7. Select Apply all on the Table page and close the notebook. 
  888.  
  889. The new SQL table is created in the same SQL database as the existing SQL 
  890. table, but has a slightly different name than the original. 
  891.  
  892.  
  893. ΓòÉΓòÉΓòÉ 7.3.2. Creating and defining a new SQL table ΓòÉΓòÉΓòÉ
  894.  
  895. You might want to create a new SQL table with different characteristics than 
  896. any existing SQL table. You can do this by using the SQL Table template in the 
  897. Shadows of Templates folder. 
  898.  
  899. To create a new SQL table: 
  900.  
  901.  1. Create a new SQL table. See Common OS/2 tasks for information on how to do 
  902.     this. An icon for the new SQL table is displayed. 
  903.  
  904.  2. Open the notebook for the new SQL table. 
  905.  
  906.  3. On the Table page, type the name of the SQL table in Name. 
  907.  
  908.  4. Type a comment describing the SQL table in the Comment field. 
  909.  
  910.  5. Add columns to the SQL table as described in Adding columns to an SQL 
  911.     table. 
  912.  
  913.  6. Select Apply all on the Table page and close the notebook. 
  914.  
  915.  
  916. ΓòÉΓòÉΓòÉ 7.4. Exporting SQL tables ΓòÉΓòÉΓòÉ
  917.  
  918. You can export a table from a database to a Visualizer table, or to the 
  919. following file types: 
  920.  
  921. o IXF (PCIXF) 
  922. o DEL 
  923. o WSF 
  924.  
  925. When you export a table, the structure and contents of the current table are 
  926. copied to the destination or file type you specify. The current table is 
  927. unchanged. 
  928.  
  929. When you export an SQL table to a Visualizer table, the data is stored 
  930. differently. Installing and Supporting Visualizer Query for OS/2 describes the 
  931. differences. 
  932.  
  933. To export a table: 
  934.  
  935.  1. Display the table you want to export. 
  936.  
  937.  2. Select Export from the Table menu. 
  938.  
  939.  3. In the Export as field, select the type of file to be exported. 
  940.  
  941.  4. Type the name of the exported table in the Name field. 
  942.  
  943.  5. If necessary, type the location of the exported table in the Location 
  944.     field. 
  945.  
  946.  6. Select Export. 
  947.  
  948.  
  949. ΓòÉΓòÉΓòÉ 8. Looking at and creating SQL views ΓòÉΓòÉΓòÉ
  950.  
  951. Use an SQL View object to access views in your SQL databases, and to create new 
  952. views. A view contains a subset of information from selected SQL tables. You 
  953. can drag and drop views onto the following objects: 
  954.  
  955. o SQL Database 
  956. o Visualizer query 
  957. o Visualizer report 
  958. o Printer 
  959. o Shredder 
  960.  
  961. You can open a view to browse and update data. You can also copy the definition 
  962. of an existing view to a new view, and you can define a new view by using a 
  963. template. 
  964.  
  965. The definition of a view consists of the statement used to create the view, a 
  966. comment describing the view and, if necessary, aliases for the columns in the 
  967. view. 
  968.  
  969. This chapter shows you how to look at data in a view, create new views, and 
  970. create aliases for columns in a view. 
  971.  
  972.  
  973. ΓòÉΓòÉΓòÉ 8.1. Looking at and changing data in a view ΓòÉΓòÉΓòÉ
  974.  
  975. When you catalog an existing database, the views in that database are available 
  976. for you to work with. You might need to update information in a view, add 
  977. information to a view, or remove information from a view. 
  978.  
  979. You can change or add information to an updateable view, but you can only 
  980. browse data in a read-only view. 
  981.  
  982. To display your data, open the view you want to work with. After the view is 
  983. displayed, you can work with it as described in Viewing and updating data in an 
  984. SQL table 
  985.  
  986.  
  987. ΓòÉΓòÉΓòÉ 8.2. Creating new views ΓòÉΓòÉΓòÉ
  988.  
  989. You can create new views from existing views, from a view designated as a 
  990. template, or from the SQL View template object in the Shadows of Templates 
  991. folder. After you create a new view, you can display it and work with it as 
  992. described in Viewing and updating data in an SQL table. 
  993.  
  994.  
  995. ΓòÉΓòÉΓòÉ 8.2.1. Creating a new view based on an existing view ΓòÉΓòÉΓòÉ
  996.  
  997. You can use the definition of an existing view as the basis of new views. You 
  998. might do this if you want to slightly modify the existing view definition to 
  999. create a new view. 
  1000.  
  1001. If you need to do this only once, you can create a new view with the same 
  1002. definition as an existing view by using the Create from menu choice. 
  1003.  
  1004. If you want to create several views based on a single definition, you can 
  1005. create a template with a specific definition. See Common OS/2 tasks for 
  1006. information on how to do this. 
  1007.  
  1008. Before you apply the new view to a database, you can change the view name and 
  1009. comment, modify the definition statement, and, if necessary, add or change 
  1010. aliases and comments for columns. After you apply the view to a database, you 
  1011. can modify only the comments for the view and for the columns in the view. See 
  1012. Updating comments for a view and its aliases for more information. 
  1013.  
  1014. To create a new view from an existing view definition: 
  1015.  
  1016.  1. Locate the existing view you want to use. 
  1017.  
  1018.  2. Ensure that all changes to the existing view are applied to the database. 
  1019.  
  1020.  3. Display the pop-up menu for the view. 
  1021.  
  1022.  4. Select Create from. An icon for the new view is displayed. 
  1023.  
  1024.  5. Open the notebook for the new view. 
  1025.  
  1026.  6. Modify the information for the view or its columns. This step is optional. 
  1027.  
  1028.  7. Select Apply all on the View page of the notebook. 
  1029.  
  1030.  8. Close the notebook. 
  1031.  
  1032. The new view is created in the same folder object as the existing view, but has 
  1033. a slightly different name than the original. 
  1034.  
  1035.  
  1036. ΓòÉΓòÉΓòÉ 8.2.2. Creating and defining a new view ΓòÉΓòÉΓòÉ
  1037.  
  1038. You might want to create a new view with different characteristics than any 
  1039. existing view. You can do this by using the SQL View template in the Shadows of 
  1040. Templates folder. 
  1041.  
  1042. To create a new view: 
  1043.  
  1044.  1. Create a new view. See Common OS/2 tasks for information on how to do this. 
  1045.     An icon for the new view is displayed. 
  1046.  
  1047.  2. Open the notebook for the new view. 
  1048.  
  1049.  3. On the View page, type a name for the view in the View field. 
  1050.  
  1051.  4. Type a comment describing the view in the Comment field. 
  1052.  
  1053.  5. On the Definition page, enter the view definition statement in the SQL 
  1054.     Definition field. 
  1055.  
  1056.    o If you are not familiar with SQL, you can create a view definition 
  1057.      statement in the following way: 
  1058.  
  1059.        a) Use a Visualizer query to select the data you want to include in the 
  1060.           view. 
  1061.  
  1062.        b) Select from the tool bar to display the underlying SQL. 
  1063.  
  1064.        c) Copy the SQL and paste it in the SQL definition field. 
  1065.  
  1066.      See Producing SQL using a query for more information on how to do this. 
  1067.  
  1068.    o If you are familiar with SQL, type the SELECT portion of the CREATE VIEW 
  1069.      statement into the SQL Definition field. 
  1070.  
  1071.  6. If necessary, create aliases for each column in the view. See Adding 
  1072.     aliases and updating comments for more information. 
  1073.  
  1074.  7. Select Apply all on the View page of the notebook. 
  1075.  
  1076.  8. Close the notebook. 
  1077.  
  1078.  
  1079. ΓòÉΓòÉΓòÉ 8.3. Adding aliases and updating comments ΓòÉΓòÉΓòÉ
  1080.  
  1081. Before you apply a view to a database, you can modify it by adding aliases. 
  1082. After you apply a view to a database, you can modify only the comments for the 
  1083. view and for any aliases in the view. 
  1084.  
  1085.  
  1086. ΓòÉΓòÉΓòÉ 8.3.1. Adding aliases for column names to an view ΓòÉΓòÉΓòÉ
  1087.  
  1088. Aliases help simplify the sometimes unwieldy column names that are stored in a 
  1089. database. You can use an alias to give a column a name that is easier for you 
  1090. to remember than the column's original name. 
  1091.  
  1092. Aliases are usually not required. However, if the view definition selects 
  1093. columns with duplicate names, or if the view definition creates a calculated 
  1094. column, you need to use aliases for the columns in the view. When using 
  1095. aliases, follow these rules: 
  1096.  
  1097. o You can only create aliases in a view that is not applied to a database. 
  1098.  
  1099. o Create aliases in the order of the columns listed in the definition 
  1100.   statement. 
  1101.  
  1102. o If you create an aliases for one column in a view, you must create aliases 
  1103.   for all the columns in the view. 
  1104.  
  1105. o After you select Apply all, you cannot change the aliases. 
  1106.  
  1107. To add aliases to a view: 
  1108.  
  1109.  1. Open the notebook to the Definition page. 
  1110.  
  1111.  2. Type a name for the alias in the Name field. 
  1112.  
  1113.  3. Type a comment for the alias in the Comment field. 
  1114.  
  1115.  4. Select Add. 
  1116.  
  1117.  5. Select Clear to clear the fields. 
  1118.  
  1119.  6. Repeat steps 2 through 5 for each column in the view. 
  1120.  
  1121.  7. Select Apply all on the View page of the notebook. 
  1122.  
  1123.  8. Close the notebook. 
  1124.  
  1125.  
  1126. ΓòÉΓòÉΓòÉ 8.3.2. Updating comments for a view and its aliases ΓòÉΓòÉΓòÉ
  1127.  
  1128. After a view is applied to a database, you can update or remove comments for 
  1129. the view and for any aliases in the view. 
  1130.  
  1131. To update a comment for a view: 
  1132.  
  1133.  1. Open the notebook. On the View page, the current comment for the view (if 
  1134.     any) is displayed in the Comment field. 
  1135.  
  1136.  2. Update or remove the comment in the Comment field. 
  1137.  
  1138.    o Edit the comment or, if no comment exists, type a new one. 
  1139.    o Highlight the comment and press the Delete key on your keyboard. 
  1140.  
  1141.  3. Select Apply all to apply the new comment to the database. 
  1142.  
  1143.  4. Close the notebook. 
  1144.  
  1145. To update comments for aliases: 
  1146.  
  1147.  1. Open the notebook. 
  1148.  
  1149.  2. On the Definition page, select an alias name from the list displayed in the 
  1150.     bottom half of the notebook. The name and comment for the selected alias 
  1151.     are displayed in the Name and Comment fields. 
  1152.  
  1153.  3. Update or delete the comment displayed in the Comment field: 
  1154.  
  1155.    o Edit the comment or, if no comment exists, type a new one. 
  1156.    o Highlight the comment and press the Delete key on your keyboard. 
  1157.  
  1158.  4. Select Modify. 
  1159.  
  1160.  5. Repeat steps 2, 3, and 4 for each comment you want to update. 
  1161.  
  1162.  6. Select Apply all on the View page of the notebook to apply the changes to 
  1163.     the database. 
  1164.  
  1165.  7. Close the notebook. 
  1166.  
  1167.  
  1168. ΓòÉΓòÉΓòÉ 9. Selecting and combining data using queries ΓòÉΓòÉΓòÉ
  1169.  
  1170. Use a Visualizer Query object to select, combine, and analyze information 
  1171. stored in an SQL database, or in files using a number of common data formats. 
  1172. Visualizer Query enables you to select just the information you need from your 
  1173. data without requiring an understanding of SQL. For example, you could select 
  1174. information on product stock levels in your warehouses, combine this with data 
  1175. on unfulfilled orders from stores, and find out if you could satisfy more 
  1176. orders by moving stock between warehouses. 
  1177.  
  1178. You can drag and drop a Visualizer Query onto the following objects: 
  1179.  
  1180. o Visualizer report 
  1181. o Folder 
  1182. o Out-basket (electronic mail) 
  1183. o Shredder 
  1184.  
  1185. This chapter describes, for those who use predefined queries, how to use a 
  1186. query to provide data for a report, and how to run a query and view the result. 
  1187. It also describes, for those defining their own queries, how to combine and 
  1188. select data from two SQL tables or views, and how to save a query. 
  1189.  
  1190.  
  1191. ΓòÉΓòÉΓòÉ 9.1. Providing data using a query ΓòÉΓòÉΓòÉ
  1192.  
  1193. If you do not define queries yourself, you can think of a query as being just 
  1194. like a data table. Like a table, it supplies the data you want in a row and 
  1195. column format. You can look at the data, and you can use it to create a report. 
  1196. Unlike SQL tables and SQL views, queries are not stored in a database object. 
  1197. You can store them in any OS/2 folder, or on the desktop. 
  1198.  
  1199. To provide data for a report using a query, drag the query and drop it on an 
  1200. open report. You can drag either the icon of a closed query, or the small icon 
  1201. of an open query. 
  1202.  
  1203.  
  1204. ΓòÉΓòÉΓòÉ 9.2. Viewing the result of a query ΓòÉΓòÉΓòÉ
  1205.  
  1206. The data that a query provides is called the result of the query. This data is 
  1207. not stored in the query, but is retrieved from other data sources when you run 
  1208. the query. You must run a query before you can look at its result. 
  1209.  
  1210. To run a query without opening it: 
  1211.  
  1212.  1. Display the pop-up menu for the query. 
  1213.  2. Select the arrow to the right of Open. 
  1214.  3. Select Run query. 
  1215.  
  1216. If Run query has a check mark next to it, it is the default selection on the 
  1217. cascaded menu. In this case, you can run the query by double-clicking on its 
  1218. icon. For information on how to change the default selection on the cascaded 
  1219. menu, see Retrieving and manipulating data using queries. 
  1220.  
  1221. To run an open query, select from the tool bar. 
  1222.  
  1223. The result of the query is shown in a browsing window. You can look at the data 
  1224. in this window, but you cannot update it. You can see the result either in row 
  1225. and column format, called the table view, or in index card format, called the 
  1226. form view. 
  1227.  
  1228. Use the table view to show information about lots of items at once. Choose the 
  1229. table view by selecting from the tool bar. 
  1230.  
  1231. Use the form view to show information about a single item at a time. Choose the 
  1232. form view by selecting from the tool bar. 
  1233.  
  1234. You can save the result as a table or in a number of other data formats in the 
  1235. OS/2 file system. For more information about using the data browsing window, 
  1236. see Viewing and updating data in an SQL table. 
  1237.  
  1238.  
  1239. ΓòÉΓòÉΓòÉ 9.3. Defining a simple query ΓòÉΓòÉΓòÉ
  1240.  
  1241. Sometimes the data you want to see is held in more than one table or view. 
  1242. Sometimes you may not want to see a whole table, but only information about 
  1243. specific items in the table. Use a query to combine data from several related 
  1244. tables or views and to select just the data you want. 
  1245.  
  1246. Defining a query to combine data in two tables or views is very easy, and is 
  1247. described in detail in the following sections. The basic steps are: 
  1248.  
  1249.  1. Create a new query and rename it. See Common OS/2 tasks for information on 
  1250.     how to do this. 
  1251.  
  1252.  2. Open the query. 
  1253.  
  1254.  3. Select the tables and views you need. For information on how to do this, 
  1255.     see Selecting data sources for your query. 
  1256.  
  1257.  4. Link the data sources. QUERY FOR OS/2 can do this for you if you choose. 
  1258.     For further information, see Combining data sources. 
  1259.  
  1260. When you have combined the data in the two tables or views, you can choose to 
  1261. see data about specific items, rather than looking at all the combined data. 
  1262. For example, if your combined data is about products you sell, you might want 
  1263. to look at only the data for one or two specific products. For information on 
  1264. how to do this, see Selecting rows of data. 
  1265.  
  1266. You can also choose not to see all the available information about the specific 
  1267. items you have selected. For example, your combined product data might contain 
  1268. data about how each product is packaged. You can choose to see all the data 
  1269. about the products you have selected except the packaging data. For information 
  1270. on how to do this, see Selecting columns of data. 
  1271.  
  1272.  
  1273. ΓòÉΓòÉΓòÉ 9.4. Selecting data sources for your query ΓòÉΓòÉΓòÉ
  1274.  
  1275. You can select any of the following data sources to use in a query: 
  1276.  
  1277. o SQL tables 
  1278. o SQL views 
  1279. o Queries 
  1280. o Visualizer tables 
  1281.  
  1282. All SQL tables and SQL views in a query must be associated with the same 
  1283. database object. You cannot mix Visualizer tables or external data formats with 
  1284. SQL tables or SQL views within a single query. 
  1285.  
  1286.  
  1287. ΓòÉΓòÉΓòÉ 9.4.1. Selecting data source icons ΓòÉΓòÉΓòÉ
  1288.  
  1289. Usually, you can see the icons of the data sources you want. For example, they 
  1290. might be in a database object, or on the desktop. 
  1291.  
  1292. To select data sources for your query when you can see their icons, drag the 
  1293. icons one by one, and drop them on an open query. 
  1294.  
  1295.  
  1296. ΓòÉΓòÉΓòÉ 9.4.2. Selecting data sources without icons ΓòÉΓòÉΓòÉ
  1297.  
  1298. Sometimes you may not be able to see the icon of a data source you want. It 
  1299. might not exist on your workstation, or you might not know where it is. 
  1300.  
  1301. If you cannot find an icon you want, select from the tool bar. The Select 
  1302. Tables and Queries and the Selected Tables and Queries windows are displayed. 
  1303.  
  1304. Use the Select Tables and Queries window to find data sources in the OS/2 file 
  1305. system, and other data sources cataloged on your workstation. For more 
  1306. information on finding data sources that are not stored in an SQL database, see 
  1307. the online help for the Select Tables and Queries window. 
  1308.  
  1309. To select tables and views from SQL databases: 
  1310.  
  1311.  1. Ensure that SQL is selected in the Type list. (SQL is the default 
  1312.     selection). 
  1313.  
  1314.     A list of all the SQL databases that you have cataloged on your workstation 
  1315.     is shown in the Locations list. 
  1316.  
  1317.  2. Select a database in the Locations list. 
  1318.  
  1319.     A list of all collection names associated with the selected database is 
  1320.     shown in the Locations list. The collection name (sometimes called the 
  1321.     table prefix) is usually the same as the user ID of the person who created 
  1322.     the tables and views. 
  1323.  
  1324.  3. Select a collection name in the Locations list. 
  1325.  
  1326.     A list of tables and views identified by the selected collection name is 
  1327.     shown in the Names list. 
  1328.  
  1329.  4. Press and hold down the Ctrl key, and select the tables and views you want. 
  1330.  
  1331.     As you select tables and views, their names are displayed in the Selected 
  1332.     Tables and Queries window. 
  1333.  
  1334.  5. In the Select Tables and Queries window, select OK. 
  1335.  
  1336.  
  1337. ΓòÉΓòÉΓòÉ 9.5. Combining data sources ΓòÉΓòÉΓòÉ
  1338.  
  1339. For each data source you have selected, an entry appears in the Data sources 
  1340. list in the query main window. At the top of the entry is the name of the data 
  1341. source. Below this, the columns available in the data source are listed. 
  1342.  
  1343. To combine related data from more than one data source, the data sources must 
  1344. be linked. (You do not need to understand linking to define a simple query, but 
  1345. if you are interested in knowing more, see Understanding links.) You can 
  1346. identify a linked column by the symbol () that appears next to it in a link 
  1347. entry. A link entry is an area in the data sources list between each data 
  1348. source and the next one. You can recognize a link entry by the symbols > < that 
  1349. appear at the top of the entry. 
  1350.  
  1351. Depending on the settings of the data sources you are using, there may already 
  1352. be link symbols () in some or all of the link entries. A link symbol appears 
  1353. next to a column that has been linked to a column in another data source. 
  1354. Visualizer Query automatically created these links when you selected the data 
  1355. sources. If all the link entries contain at least one link symbol (), you do 
  1356. not need to take any further action. The data sources are ready to be combined. 
  1357.  
  1358. If any of the link entries are empty, create default links for that entry: 
  1359.  
  1360.  1. Double-click on the link entry. The Link Settings window is displayed. 
  1361.  
  1362.  2. Select Auto join. 
  1363.  
  1364.     The names of the columns that have been linked are shown in the Linked 
  1365.     columns list. 
  1366.  
  1367.  3. Select OK. 
  1368.  
  1369. When all the link entries in your query contain link symbols, your data sources 
  1370. are ready to be combined. 
  1371.  
  1372.  
  1373. ΓòÉΓòÉΓòÉ 9.5.1. Understanding links ΓòÉΓòÉΓòÉ
  1374.  
  1375. When you link data sources, you: 
  1376.  
  1377. o Specify which columns in one data source relate to columns in other data 
  1378.   sources. Only some of the columns in a data source have any relationship with 
  1379.   columns in other data sources. 
  1380.  
  1381. o Specify how the tables should be combined. Do this by specifying the type of 
  1382.   link to be used. To combine columns from several different, but related, data 
  1383.   sources so that the data appears to be in one larger data source, use the 
  1384.   join link type. 
  1385.  
  1386. For example, in the query shown in Combining data sources, the tables ORDERS 
  1387. and PART_NUM are related. They are related because they both contain a column 
  1388. containing the same information, PARTNO. 
  1389.  
  1390. The person who created the two tables included this column in both tables so 
  1391. that they could be cross-referenced. Any specific row in the ORDERS table has a 
  1392. part number in the PARTNO column. To find out what the part is, you have to 
  1393. look in the PART_NUM table and find the row corresponding to this part number. 
  1394. The part is described in the PART and PARTNAME columns of the PART_NUM table. 
  1395.  
  1396. When you run this query, it combines the two tables using a join. For each row 
  1397. in the ORDERS table, it looks up the relevant row in the PART_NUM table, and 
  1398. appends this to the end of the row in the ORDERS table. The PARTNO column from 
  1399. the second table is not shown in the result, as it contains the same 
  1400. information as the one in the first table. 
  1401.  
  1402. This operation is shown in the following diagram: 
  1403.  
  1404. ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ  ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  1405. Γöé PARTNO Γöé DEPOT   Γöé QUANTITY Γöé  Γöé PARTNO Γöé PART  Γöé PARTNAME    Γöé
  1406. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ  Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  1407. Γöé 300   Γöé New York Γöé 12    Γöé  Γöé 300   Γöé Bolt  Γöé 4inch steel  Γöé
  1408. Γöé 500   Γöé New York Γöé 200    Γöé  Γöé 500   Γöé Nut   Γöé 1inch steel  Γöé
  1409. Γöé 300   Γöé Montreal Γöé 74    Γöé  Γöé 700   Γöé Washer Γöé M5 shakeproof Γöé
  1410. Γöé 300   Γöé New York Γöé 43    Γöé  ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  1411. Γöé 500   Γöé Montreal Γöé 32    Γöé   PART_NUM
  1412. Γöé 500   Γöé Montreal Γöé 82    Γöé
  1413. ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  1414.  ORDERS
  1415.  
  1416.     ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  1417.                   
  1418.     ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  1419.     Γöé PARTNO Γöé DEPOT   Γöé QUANTITY Γöé PART  Γöé PARTNAME   Γöé
  1420.     Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  1421.     Γöé 300   Γöé New York Γöé 12    Γöé Bolt  Γöé 4inch steel Γöé
  1422.     Γöé 500   Γöé New York Γöé 200    Γöé Nut  Γöé 1inch steel Γöé
  1423.     Γöé 300   Γöé Montreal Γöé 74    Γöé Bolt  Γöé 4inch steel Γöé
  1424.     Γöé 300   Γöé New York Γöé 43    Γöé Bolt  Γöé 4inch steel Γöé
  1425.     Γöé 500   Γöé Montreal Γöé 32    Γöé Nut  Γöé 1inch steel Γöé
  1426.     Γöé 500   Γöé Montreal Γöé 82    Γöé Nut  Γöé 1inch steel Γöé
  1427.     ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  1428.      Result
  1429.  
  1430. This explanation of a join has been slightly simplified. For more information 
  1431. about joins, and all the other kinds of links supported by query, see Choosing 
  1432. a link type. 
  1433.  
  1434.  
  1435. ΓòÉΓòÉΓòÉ 9.6. Selecting rows of data ΓòÉΓòÉΓòÉ
  1436.  
  1437. Use query to select rows of data that fulfill a specified condition. You can 
  1438. select rows from either a single data source, or from the result of linking 
  1439. several data sources. You might want to select rows for any of these reasons: 
  1440.  
  1441. o You are only interested in certain items in the data, and don't want to look 
  1442.   at all the items. For example, you have data about lots of products, but are 
  1443.   only interested in those sold under a specific brand name. 
  1444.  
  1445. o You want to highlight items that need your attention. For example, it would 
  1446.   be useful to know which of your account customers have not paid their bills 
  1447.   for more than 3 months. 
  1448.  
  1449. o You want to look at data that has so many rows that it would need more memory 
  1450.   than you have in your workstation. For example, you have a huge mainframe 
  1451.   database of daily sales figures for stores in major cities across the 
  1452.   country. You can look at the data for each city in turn, or for each separate 
  1453.   product line countrywide. 
  1454.  
  1455. To select rows: 
  1456.  
  1457.  1. Select from the tool bar. The Select Rows window is displayed. 
  1458.  
  1459.  2. Type an expression that specifies the rows you want. 
  1460.  
  1461.     For example, the expression shown specifies that only rows where the depot 
  1462.     is New York or Montreal should be selected. 
  1463.  
  1464.     Type your expression using the syntax indicated in brackets above the 
  1465.     Expression field. If you aren't familiar with the syntax indicated, see 
  1466.     Point and click expression entry. 
  1467.  
  1468.  3. In the Select Rows window, select OK. 
  1469.  
  1470.  
  1471. ΓòÉΓòÉΓòÉ 9.6.1. Point and click expression entry ΓòÉΓòÉΓòÉ
  1472.  
  1473. Use the Expression Builder window to help you type expressions in the correct 
  1474. syntax even when you are not familiar with the syntax. Whenever you see in a 
  1475. window, the Expression Builder window is available to help you. 
  1476.  
  1477. To create the expression shown in Selecting rows of data 
  1478.  
  1479.  1. Select to display the Expression Builder window. 
  1480.  
  1481.  2. Select DEPOT from the column names in the Operands and operators list on 
  1482.     the left of the window. 
  1483.  
  1484.  3. Select Comparison operators from the Operand and operator types list on the 
  1485.     right of the window. 
  1486.  
  1487.  4. Select = from the refreshed list on the left of the window. 
  1488.  
  1489.  5. Type `New York` in the Expression field. 
  1490.  
  1491.     In SQL syntax, when you want to look for specific words in a column, 
  1492.     enclose them in single quotes. If you are looking for specific numeric 
  1493.     values in a column, the quotes are not required. 
  1494.  
  1495.  6. Select Logic symbols from the list on the right. 
  1496.  
  1497.  7. Select OR from the list on the left. 
  1498.  
  1499.  8. Repeat steps 2 through 4 
  1500.  
  1501.  9. Type in the Expression field. 
  1502.  
  1503. 10. Select OK. 
  1504.  
  1505. Your expression is checked to ensure the syntax is correct, and the Expression 
  1506. Builder window closes. The expression you have built is shown in the window in 
  1507. which you selected . 
  1508.  
  1509.  
  1510. ΓòÉΓòÉΓòÉ 9.7. Selecting columns of data ΓòÉΓòÉΓòÉ
  1511.  
  1512. Use query to select specific columns of data. You can select columns from 
  1513. either a single data source, or from the result of linking several data 
  1514. sources. You might want to select columns for these reasons: 
  1515.  
  1516. o You are only interested in some of the information that is held about each 
  1517.   item in the data source. For example, you have data about your suppliers. You 
  1518.   are interested in their contact names and phone numbers, but not their 
  1519.   addresses. 
  1520.  
  1521. o You want to look at data from a large data source that would need more memory 
  1522.   than you have in your workstation. For example, you have a mainframe database 
  1523.   of credit card transactions across the country. You are only interested in 
  1524.   the amount spent in each city, and not in the merchant's name or reference 
  1525.   number. 
  1526.  
  1527. To select columns: 
  1528.  
  1529.  1. Select from the tool bar. The Select Columns window is displayed. 
  1530.  
  1531.     By default, all available columns are selected. 
  1532.  
  1533.  2. Deselect the columns you do not want. If you only want a few columns from a 
  1534.     list that contains many, select the Deselect all push button and then 
  1535.     select the columns you want. 
  1536.  
  1537.  3. Select OK. 
  1538.  
  1539.  
  1540. ΓòÉΓòÉΓòÉ 9.8. Saving a query ΓòÉΓòÉΓòÉ
  1541.  
  1542. To save a query, select Save from the Query menu. The query is saved in the 
  1543. OS/2 file system. 
  1544.  
  1545. You cannot select Save if you do not have write access to the query that you 
  1546. have opened. However, you can save it using a different name or location. 
  1547.  
  1548. To save a query using a different name or location: 
  1549.  
  1550.  1. Select Copy to from the Query menu. 
  1551.  2. In the Copy To window, type a file name for the query in Name. 
  1552.  3. Type a location for the query in Location. 
  1553.  4. Select OK. 
  1554.  
  1555.  
  1556. ΓòÉΓòÉΓòÉ 10. Retrieving and manipulating data using queries ΓòÉΓòÉΓòÉ
  1557.  
  1558. Use a Visualizer Query object to retrieve and manipulate data from one or more 
  1559. data sources. You can select and combine data from one data source using 
  1560. another, calculate data, group data and summarize data. This chapter covers the 
  1561. following topics: 
  1562.  
  1563. o Creating different types of joins 
  1564. o Embedding one query within another 
  1565. o Using advanced options 
  1566. o Reusing queries by including variables 
  1567. o Creating queries to be used by others 
  1568.  
  1569.  
  1570. ΓòÉΓòÉΓòÉ 10.1. Defining a query ΓòÉΓòÉΓòÉ
  1571.  
  1572. The previous chapter described how to define a simple query using a single data 
  1573. source, or two data sources linked with a join, and row and column selections. 
  1574. However, you can use the powerful features of Visualizer Query to define 
  1575. considerably more complex queries when you need them to retrieve the result you 
  1576. want. The data shown in the result of a query is determined by the following: 
  1577.  
  1578. o The data sources you select, and the order in which you select them. 
  1579.  
  1580.   For more information, see: 
  1581.  
  1582.    - Selecting data sources 
  1583.    - Mixing different types of data in a query 
  1584.  
  1585. o The types of links you specify when linking data sources. 
  1586.  
  1587.   For more information, see: 
  1588.  
  1589.    - Linking data sources 
  1590.    - Choosing a link type 
  1591.  
  1592. o The expressions you use to select, calculate and summarize data. 
  1593.  
  1594.   For more information, see: 
  1595.  
  1596.    - Selecting, calculating and summarizing data 
  1597.    - Selecting data from a partial query 
  1598.  
  1599.  
  1600. ΓòÉΓòÉΓòÉ 10.2. Selecting data sources ΓòÉΓòÉΓòÉ
  1601.  
  1602. When you define a query, the order in which you select the data sources affects 
  1603. the query result in two ways: 
  1604.  
  1605. o By determining the columns available for linking when each data source is 
  1606.   added to the query. This applies when using any link type. 
  1607.  
  1608. o By determining the data source that data will be retrieved from. This applies 
  1609.   when using a semi join, an except join or an outer join. 
  1610.  
  1611.  
  1612. ΓòÉΓòÉΓòÉ 10.2.1. Making columns available for linking ΓòÉΓòÉΓòÉ
  1613.  
  1614. To make columns in a data source available for linking to more than one other 
  1615. data source, select it before the tables you want to link it to. 
  1616.  
  1617. For example, suppose you want to define a query to tell you which payment 
  1618. method your customers prefer, state by state. You have three data sources: 
  1619.  
  1620. o A table called PAYMENT that tells you the payment method used for each order 
  1621.   number. 
  1622.  
  1623. o A table called CUSTOMER that tells you which customer placed a given order 
  1624.   number. 
  1625.  
  1626. o A table called STATE, that tells you the name of the state in which each 
  1627.   customer is based. 
  1628.  
  1629. You can define the query you want by linking the three tables with a join, 
  1630. grouping the result by state name, and counting the number of times each 
  1631. payment method was used. 
  1632.  
  1633. You need to link both the PAYMENT and STATE tables to the CUSTOMER table, so 
  1634. you must select the CUSTOMER table first. Its columns are then available for 
  1635. linking to either of the other tables, which can be selected in any order. 
  1636.  
  1637.  
  1638. ΓòÉΓòÉΓòÉ 10.2.2. Controlling data retrieval ΓòÉΓòÉΓòÉ
  1639.  
  1640. You must also consider the type of links you want to use in your query when 
  1641. deciding on the order in which to select your data sources. A join produces the 
  1642. same result regardless of the order of the data sources it links. However, some 
  1643. link types produce different results depending on the order in which you 
  1644. specified the data sources they link: 
  1645.  
  1646. o Semi joins retrieve data from only the first data source 
  1647. o Except joins retrieve data from only the first data source 
  1648. o Outer joins replace non-matching data from the second data source with nulls 
  1649.  
  1650.  
  1651. ΓòÉΓòÉΓòÉ 10.3. Mixing different types of data in a query ΓòÉΓòÉΓòÉ
  1652.  
  1653. You can combine data stored in an SQL database with non-SQL database data by 
  1654. using an embedded query. An embedded query is a query that is used as a data 
  1655. source within another query. You can link columns in the result of an embedded 
  1656. query to other, non-SQL database data sources to define a new query. 
  1657.  
  1658. To combine data from an SQL database with other data: 
  1659.  
  1660.  1. Create a query that produces the result you want from the SQL database data 
  1661.     sources. 
  1662.  
  1663.  2. Create another query that uses the first query as a data source and 
  1664.     combines its result with the non-SQL database data sources. 
  1665.  
  1666. Only a query that links non-SQL database data can contain an embedded query. 
  1667.  
  1668. For example, suppose you need to combine data stored in different SQL 
  1669. databases. You might at first think you could do this by embedding a query that 
  1670. accesses one database in a query that accesses the other database. However, the 
  1671. result of a query is a non-SQL database data source, so it cannot be used in a 
  1672. query that uses SQL database data. 
  1673.  
  1674. To achieve the result you want, you need to create a query containing two 
  1675. embedded queries. The embedded queries access data in each of the two SQL 
  1676. databases, and the main query links their results. 
  1677.  
  1678.  
  1679. ΓòÉΓòÉΓòÉ 10.4. Linking data sources ΓòÉΓòÉΓòÉ
  1680.  
  1681. After you add a data source to a query, you can link its columns to columns in 
  1682. any of the data sources you previously selected. 
  1683. To link columns in a data source: 
  1684.  
  1685. To link columns in a data source: 
  1686.  
  1687.  1. Double-click on the link entry to the left of the data source in the Data 
  1688.     sources list. You can identify a link entry by the symbols > < that appear 
  1689.     at the top of the entry. 
  1690.  
  1691.     The Link Settings window is displayed. 
  1692.  
  1693.  2. Select the type of link you want from the Link type list. For more 
  1694.     information on the different types of link available, see Choosing a link 
  1695.     type. 
  1696.  
  1697.  3. Link the columns automatically or manually: 
  1698.  
  1699.    o To link columns automatically, select Auto join. Columns in the current 
  1700.      data source with the same name and data type as columns in the previous 
  1701.      data source are linked using the link type you specified. 
  1702.  
  1703.    o To link columns manually: 
  1704.  
  1705.        a) Select the columns you want to link from the lists in Link columns. 
  1706.           The Available columns list shows all columns available for linking 
  1707.           from any of the previously selected data sources. 
  1708.        b) Select the Link push button. 
  1709.  
  1710.           The columns you linked appear in the Linked columns list. 
  1711.  
  1712.  4. Select OK. 
  1713.  
  1714.  
  1715. ΓòÉΓòÉΓòÉ 10.5. Choosing a link type ΓòÉΓòÉΓòÉ
  1716.  
  1717. You can use the line types shown below in a Visualizer query. Each link type is 
  1718. described in detail. 
  1719.  
  1720. Join 
  1721.  
  1722. o Combines data sources that have a common linking column 
  1723. o Columns from both data sources are included in the result 
  1724. o Combines all rows that contain identical values in the linking column 
  1725. o Can use SQL database data source 
  1726. o Can use Query, Visualizer table, and external sources 
  1727.  
  1728. Semi Join 
  1729.  
  1730. o Selects data in one data source using data from another 
  1731. o Includes all rows containing identical values in the linking columns 
  1732. o Only columns from the first data source are included in the result 
  1733. o Can use SQL database data source 
  1734. o Can use Query, Visualizer table, and external sources 
  1735.  
  1736. Except 
  1737.  
  1738. o Excludes data in one data source using data from another 
  1739. o Includes only rows not containing identical values in the linked column 
  1740. o Only columns from the first data source are included in the result 
  1741. o Can use SQL database data source 
  1742. o Can use Query, Visualizer table, and external sources 
  1743.  
  1744. Union 
  1745.  
  1746. o Combines data in SQL database data sources with the same structure 
  1747. o If a row is unique, it is included 
  1748. o If an entire row is identical in both data sources, it is included once in 
  1749.   the result 
  1750. o If a row is not identical in both data sources, both rows are included 
  1751. o If necessary, a new key column is created in the result 
  1752. o Can use SQL database data source 
  1753.  
  1754. Unite 
  1755.  
  1756. o Combines data in non-SQL database data sources with the same structure 
  1757. o A row is included in the result only if it has a unique key 
  1758. o Non-key columns are not compared 
  1759. o If the linked key columns contain identical values, the row from the second 
  1760.   data source is included 
  1761. o If the linked key columns do not contain identical values, the rows from both 
  1762.   data sources are included 
  1763. o Can use Query, Visualizer table, and external sources 
  1764.  
  1765. Outer join 
  1766.  
  1767. o Can be used to check the referential integrity of your data 
  1768. o Includes all rows from the first table in the result 
  1769. o Includes columns from both tables 
  1770. o If there is no corresponding row in the second table, null values are shown 
  1771.   for the columns from the second table 
  1772. o Can use Query, Visualizer table, and external sources 
  1773.  
  1774.  
  1775. ΓòÉΓòÉΓòÉ 10.5.1. Join ΓòÉΓòÉΓòÉ
  1776.  
  1777. Use Join to define a natural join between two data sources that includes, from 
  1778. both data sources, all rows containing identical values in the linking columns 
  1779. common to each. All the linked columns from the first data source are shown in 
  1780. the result, together with all unlinked columns from both data sources. 
  1781.  
  1782. In the example below, the linking column is A and matching rows are in red. 
  1783.  
  1784. ΓöîΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ  ΓöîΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  1785. Γöé A  Γöé B   Γöé C   Γöé  Γöé A  Γöé D  Γöé E    Γöé F    Γöé
  1786. Γö£ΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ  Γö£ΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  1787. Γöé 10 Γöé Smith Γöé 50322 Γöé  Γöé 30 Γöé XYZ Γöé 500.32 Γöé 324.89 Γöé
  1788. Γöé 20 Γöé Jones Γöé 46324 Γöé  Γöé 50 Γöé AAA Γöé 234.53 Γöé 743.92 Γöé
  1789. Γöé 30 Γöé Brown Γöé 96232 Γöé  Γöé 70 Γöé AAA Γöé 621.70 Γöé 634.58 Γöé
  1790. Γöé 40 Γöé Call  Γöé 72355 Γöé  ΓööΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  1791. Γöé 50 Γöé Davis Γöé 32553 Γöé   Second data source
  1792. Γöé 60 Γöé Reed  Γöé 82375 Γöé
  1793. ΓööΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  1794.  First data source
  1795.  
  1796.     ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  1797.               
  1798.    ΓöîΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  1799.    Γöé A  Γöé B   Γöé C   Γöé D  Γöé E    Γöé F    Γöé
  1800.    Γö£ΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  1801.    Γöé 30 Γöé Brown Γöé 96232 Γöé XYZ Γöé 500.32 Γöé 324.89 Γöé
  1802.    Γöé 50 Γöé Davis Γöé 32553 Γöé AAA Γöé 234.53 Γöé 743.92 Γöé
  1803.    ΓööΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  1804.      Result
  1805.  
  1806.  
  1807. ΓòÉΓòÉΓòÉ 10.5.2. Semi Join ΓòÉΓòÉΓòÉ
  1808.  
  1809. Use Semi Join to define a join between two data sources that includes, from 
  1810. both data sources, all rows containing identical values in the linking column 
  1811. common to each, but only uses columns from the first data sources selected for 
  1812. the join. 
  1813.  
  1814. In the example below, the linking column is A, and matching rows are in a red. 
  1815.  
  1816. ΓöîΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ  ΓöîΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  1817. Γöé A  Γöé B   Γöé C   Γöé  Γöé A  Γöé D  Γöé E    Γöé F    Γöé
  1818. Γö£ΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ  Γö£ΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  1819. Γöé 10 Γöé Smith Γöé 50322 Γöé  Γöé 30 Γöé XYZ Γöé 500.32 Γöé 324.89 Γöé
  1820. Γöé 20 Γöé Jones Γöé 46324 Γöé  Γöé 50 Γöé AAA Γöé 234.53 Γöé 743.92 Γöé
  1821. Γöé 30 Γöé Brown Γöé 96232 Γöé  Γöé 70 Γöé AAA Γöé 621.70 Γöé 634.58 Γöé
  1822. Γöé 40 Γöé Call  Γöé 72355 Γöé  ΓööΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  1823. Γöé 50 Γöé Davis Γöé 32553 Γöé   Second data source
  1824. Γöé 60 Γöé Reed  Γöé 82375 Γöé
  1825. ΓööΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  1826.  First data source
  1827.  
  1828.     ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  1829.               
  1830.          ΓöîΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  1831.          Γöé A  Γöé B   Γöé C   Γöé
  1832.          Γö£ΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  1833.          Γöé 30 Γöé Brown Γöé 96232 Γöé
  1834.          Γöé 50 Γöé Davis Γöé 32553 Γöé
  1835.          ΓööΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  1836.          Result
  1837.  
  1838. Use Except to get the opposite result of a semi join. 
  1839.  
  1840.  
  1841. ΓòÉΓòÉΓòÉ 10.5.3. Except ΓòÉΓòÉΓòÉ
  1842.  
  1843. Use Except to define a join between two data sources that includes, from both 
  1844. data sources, all rows not containing identical values in the linking column 
  1845. common to each, but that uses only columns from the first data source selected 
  1846. for the join. 
  1847.  
  1848. In the example below, the linking column is A, and matching rows are in red. 
  1849.  
  1850. ΓöîΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ  ΓöîΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  1851. Γöé A  Γöé B   Γöé C   Γöé  Γöé A  Γöé D  Γöé E    Γöé F    Γöé
  1852. Γö£ΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ  Γö£ΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  1853. Γöé 10 Γöé Smith Γöé 50322 Γöé  Γöé 30 Γöé XYZ Γöé 500.32 Γöé 324.89 Γöé
  1854. Γöé 20 Γöé Jones Γöé 46324 Γöé  Γöé 50 Γöé AAA Γöé 234.53 Γöé 743.92 Γöé
  1855. Γöé 30 Γöé Brown Γöé 96232 Γöé  Γöé 70 Γöé AAA Γöé 621.70 Γöé 634.58 Γöé
  1856. Γöé 40 Γöé Call  Γöé 72355 Γöé  ΓööΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  1857. Γöé 50 Γöé Davis Γöé 32553 Γöé   Second data source
  1858. Γöé 60 Γöé Reed  Γöé 82375 Γöé
  1859. ΓööΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  1860.  First data source
  1861.  
  1862.     ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  1863.               
  1864.          ΓöîΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  1865.          Γöé A  Γöé B   Γöé C   Γöé
  1866.          Γö£ΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  1867.          Γöé 10 Γöé Smith Γöé 50322 Γöé
  1868.          Γöé 20 Γöé Jones Γöé 46324 Γöé
  1869.          Γöé 40 Γöé Call  Γöé 72355 Γöé
  1870.          Γöé 60 Γöé Reed  Γöé 82375 Γöé
  1871.          ΓööΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  1872.          Result
  1873.  
  1874. Use Semi Join to get the opposite result of an Except join. 
  1875.  
  1876.  
  1877. ΓòÉΓòÉΓòÉ 10.5.4. Union ΓòÉΓòÉΓòÉ
  1878.  
  1879. Use Union to define a join between two SQL data sources that includes all the 
  1880. rows of the two data sources, but shows duplicate rows only once in the result. 
  1881.  
  1882. The two data sources must have the same structure, with the same number of 
  1883. columns, the same column names and the same column data types. Each pair of 
  1884. columns is linked automatically. If a pair of linked columns contains different 
  1885. values for a row, the rows from both data sources are shown, and a new key 
  1886. column is generated if necessary. 
  1887.  
  1888. In the example below, the linking columns are A and B, and matching rows are in 
  1889. red. However, the matched rows have only partially matching values in the 
  1890. columns. Magenta represents values in the first data source that are different 
  1891. from the corresponding values in the second. 
  1892.  
  1893. ΓöîΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ  ΓöîΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  1894. Γöé A  Γöé B   Γöé C   Γöé  Γöé A  Γöé B   Γöé C   Γöé
  1895. Γö£ΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ  Γö£ΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  1896. Γöé 10 Γöé Smith Γöé 50322 Γöé  Γöé 20 Γöé Jones Γöé 46324 Γöé
  1897. Γöé 20 Γöé Jones Γöé 74554 Γöé  Γöé 40 Γöé Call  Γöé 72355 Γöé
  1898. Γöé 30 Γöé Brown Γöé 98232 Γöé  Γöé 50 Γöé Ward  Γöé 97805 Γöé
  1899. Γöé 40 Γöé King  Γöé 26355 Γöé  ΓööΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  1900. ΓööΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ   Second data source
  1901.  First data source
  1902.  
  1903.     ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  1904.             
  1905.      ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  1906.      Γöé Key Γöé A  Γöé B   Γöé C   Γöé
  1907.      Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  1908.      Γöé 1  Γöé 10 Γöé Smith Γöé 50322 Γöé
  1909.      Γöé 2  Γöé 20 Γöé Jones Γöé 74554 Γöé
  1910.      Γöé 3  Γöé 20 Γöé Jones Γöé 46324 Γöé
  1911.      Γöé 4  Γöé 30 Γöé Brown Γöé 98232 Γöé
  1912.      Γöé 5  Γöé 40 Γöé Call  Γöé 72355 Γöé
  1913.      Γöé 6  Γöé 40 Γöé King  Γöé 26355 Γöé
  1914.      Γöé 7  Γöé 50 Γöé Ward  Γöé 97805 Γöé
  1915.      ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  1916.       Result
  1917.  
  1918.  
  1919. ΓòÉΓòÉΓòÉ 10.5.5. Unite ΓòÉΓòÉΓòÉ
  1920.  
  1921. Use Unite to define a join between two non-SQL data sources that includes all 
  1922. the rows of the two data sources, but shows duplicate rows only once in the 
  1923. result. 
  1924.  
  1925. The two data sources must have the same column names, as each pair of 
  1926. identically-named columns is linked automatically. If the linked key columns 
  1927. contain identical values for a row, only values from the row in the second data 
  1928. source are included in the result. If the linked key columns contain different 
  1929. values, the rows from both data sources are included. The values in non-key 
  1930. columns are not compared. 
  1931.  
  1932. To ensure that all nonduplicate rows are included in the result, all columns in 
  1933. the two data sources must be key columns. 
  1934.  
  1935. In the example below, the linking columns are A and B, and matching rows are in 
  1936. red However, the matched rows have only partially matching values in the 
  1937. columns. Magenta represents values in the first data source that are different 
  1938. from the corresponding values in the second. 
  1939.  
  1940. ΓöîΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ  ΓöîΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  1941. Γöé A  Γöé B   Γöé C   Γöé  Γöé A  Γöé B   Γöé C   Γöé
  1942. Γö£ΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ  Γö£ΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  1943. Γöé 10 Γöé Smith Γöé 50322 Γöé  Γöé 20 Γöé Jones Γöé 46324 Γöé
  1944. Γöé 20 Γöé Jones Γöé 74554 Γöé  Γöé 40 Γöé Call  Γöé 72355 Γöé
  1945. Γöé 30 Γöé Brown Γöé 98232 Γöé  Γöé 50 Γöé Ward  Γöé 97805 Γöé
  1946. Γöé 40 Γöé King  Γöé 26355 Γöé  ΓööΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  1947. ΓööΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ   Second data source
  1948.  First data source
  1949.  
  1950.     ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  1951.             
  1952.        ΓöîΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  1953.        Γöé A  Γöé B   Γöé C   Γöé
  1954.        Γö£ΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  1955.        Γöé 10 Γöé Smith Γöé 50322 Γöé
  1956.        Γöé 20 Γöé Jones Γöé 46324 Γöé
  1957.        Γöé 30 Γöé Brown Γöé 98232 Γöé
  1958.        Γöé 40 Γöé Call  Γöé 72355 Γöé
  1959.        Γöé 40 Γöé King  Γöé 26355 Γöé
  1960.        Γöé 50 Γöé Ward  Γöé 97805 Γöé
  1961.        ΓööΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  1962.        Result
  1963.  
  1964.  
  1965. ΓòÉΓòÉΓòÉ 10.5.6. Outer Join ΓòÉΓòÉΓòÉ
  1966.  
  1967. Use Outer Join to define a natural join between two data sources that includes 
  1968. all rows from the first data source, and all columns from both data sources, 
  1969. except the linking column in the second data source. If, in the common linking 
  1970. column, there is no corresponding row value in the second data source, null 
  1971. values are shown for the remaining columns from the second data source. 
  1972.  
  1973. This type of join is useful if you want to detect any problems in your 
  1974. database, such as loss of data, or unknown values. 
  1975.  
  1976. In the example below, the linking column is A and matching columns are in red. 
  1977. The black areas in the joined table represent null values. 
  1978.  
  1979. ΓöîΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ  ΓöîΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  1980. Γöé A  Γöé B   Γöé C   Γöé  Γöé A  Γöé D  Γöé E    Γöé F    Γöé
  1981. Γö£ΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ  Γö£ΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  1982. Γöé 10 Γöé Smith Γöé 50322 Γöé  Γöé 30 Γöé XYZ Γöé 500.32 Γöé 324.89 Γöé
  1983. Γöé 20 Γöé Jones Γöé 46324 Γöé  Γöé 50 Γöé AAA Γöé 234.53 Γöé 743.92 Γöé
  1984. Γöé 30 Γöé Brown Γöé 96232 Γöé  Γöé 70 Γöé AAA Γöé 621.70 Γöé 634.58 Γöé
  1985. Γöé 40 Γöé Call  Γöé 72355 Γöé  ΓööΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  1986. Γöé 50 Γöé Davis Γöé 32553 Γöé   Second data source
  1987. Γöé 60 Γöé Reed  Γöé 82375 Γöé
  1988. ΓööΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  1989.  First data source
  1990.  
  1991.     ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  1992.               
  1993.    ΓöîΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  1994.    Γöé A  Γöé B   Γöé C   Γöé D  Γöé E    Γöé F    Γöé
  1995.    Γö£ΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  1996.    Γöé 10 Γöé Smith Γöé 50322 Γöé   Γöé     Γöé     Γöé
  1997.    Γöé 20 Γöé Jones Γöé 46324 Γöé   Γöé     Γöé     Γöé
  1998.    Γöé 30 Γöé Brown Γöé 96232 Γöé XYZ Γöé 500.32 Γöé 324.89 Γöé
  1999.    Γöé 40 Γöé Call  Γöé 72355 Γöé   Γöé     Γöé     Γöé
  2000.    Γöé 50 Γöé Davis Γöé 32553 Γöé AAA Γöé 234.53 Γöé 743.92 Γöé
  2001.    Γöé 60 Γöé Reed  Γöé 82375 Γöé   Γöé     Γöé     Γöé
  2002.    ΓööΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  2003.     Result
  2004.  
  2005.  
  2006. ΓòÉΓòÉΓòÉ 10.6. Selecting, calculating and summarizing data ΓòÉΓòÉΓòÉ
  2007.  
  2008. After you link the data sources in a query, you can specify any of the 
  2009. following to complete the query definition: 
  2010.  
  2011. o Calculated columns 
  2012. o Row selections 
  2013. o Column selections 
  2014. o Data grouping 
  2015. o Data summaries 
  2016.  
  2017. QUERY FOR OS/2 helps you to define your query in the most efficient way by 
  2018. providing choices on the Query menu (and, when you select Advanced options, on 
  2019. the Selected menu) in the order in which you should use them: 
  2020.  
  2021.  1. Calculate columns 
  2022.  2. Select rows 
  2023.  3. Rename columns 
  2024.  4. Select columns 
  2025.  5. Define summary 
  2026.  
  2027. You need not apply any of these actions to a query, but if you do apply one of 
  2028. them, you cannot then select an action that appears higher in the list. 
  2029.  
  2030. For example, suppose that a query is made up of two tables, TABLE1 and TABLE2, 
  2031. linked with a join. If you apply a Select rows action to the query (by 
  2032. selecting OK on the Select Rows window), it is not then possible to calculate 
  2033. columns for the query. However, you can still rename or select columns for the 
  2034. query. 
  2035.  
  2036. Define summary is the last choice on the menu. After you define and apply 
  2037. summary operations using the Define Summary window, you cannot select any of 
  2038. the menu choices above it. However, you can temporarily suspend the summary 
  2039. definition if you want to select these actions. To do this, select Suspend 
  2040. summary on the Define Summary window. 
  2041.  
  2042.  
  2043. ΓòÉΓòÉΓòÉ 10.6.1. Selecting rows and columns ΓòÉΓòÉΓòÉ
  2044.  
  2045. In most cases you can make your row and column selections by selecting and from 
  2046. the tool bar. This is the same as selecting Select rows and Select columns from 
  2047. the Query menu, and applies the selections to the entire query. In a few cases, 
  2048. especially when linking data sources with a semi join, an except join, or an 
  2049. outer join, you might want to select rows and columns from a partial query. See 
  2050. Selecting data from a partial query for information on how to do this. 
  2051.  
  2052.  
  2053. ΓòÉΓòÉΓòÉ 10.6.2. Calculating columns ΓòÉΓòÉΓòÉ
  2054.  
  2055. A calculated column contains data that is calculated row by row from data in 
  2056. other columns, according to a calculation expression that you specify. The 
  2057. calculated column does not exist in the original data sources, but is produced 
  2058. when you run the query. 
  2059.  
  2060. For example, suppose you had a column in a table that contained the cost price 
  2061. of your products. You could create a calculated column that contains the retail 
  2062. price by typing an expression to calculate a fixed mark-up: 
  2063.  
  2064. "Retail Price" = "Cost Price"*1.5
  2065.  
  2066. To create a calculated column: 
  2067.  
  2068.  1. Select from the tool bar. The Calculate Columns window is displayed. 
  2069.  
  2070.  2. Type a name for the calculated column in Result name. 
  2071.  
  2072.  3. Type a calculation expression to produce the data you want in Expression. 
  2073.     See Point and click expression entry for information on how to use the 
  2074.     Expression Builder to help you create an expression. 
  2075.  
  2076.  4. Select Format to specify how numbers are shown in the calculated column. 
  2077.     This step is optional. 
  2078.  
  2079.  5. Select OK. 
  2080.  
  2081.  
  2082. ΓòÉΓòÉΓòÉ 10.6.3. Grouping and summarizing data ΓòÉΓòÉΓòÉ
  2083.  
  2084. Grouping data means ordering it so that rows having the same value in a 
  2085. specified column are shown together in a contiguous block or group. Grouping 
  2086. data makes it easier to read, because related items are shown together. For 
  2087. example, if you grouped a query using a column called STATE, you would see all 
  2088. customers in, for example, Vermont, shown together in a block in the query 
  2089. result. 
  2090.  
  2091. To summarize data, you create a new column to contain a summary value. The 
  2092. summary value is calculated using an expression that you specify. The following 
  2093. summary types are predefined so that you can select them from a list: 
  2094.  
  2095. o Minimum 
  2096. o Maximum 
  2097. o Sum 
  2098. o Average 
  2099. o Count 
  2100.  
  2101. For more information on these summary types, see the online help for the Define 
  2102. Summary window. 
  2103.  
  2104. Summary values are calculated for the columns you specify and, if you have 
  2105. created groups, for each group. 
  2106.  
  2107. To group and summarize data: 
  2108.  
  2109.  1. Select from the tool bar. The Define Summary window opens. 
  2110.  
  2111.  2. Select the columns you want to use to create groups from the lists in 
  2112.     Grouping columns. 
  2113.  
  2114.     You can specify up to five columns, although only two are shown initially. 
  2115.     The second and subsequent groups you specify are nested within the 
  2116.     preceding level of grouping. 
  2117.  
  2118.  3. Type a name for a new column to contain the summary data in New column. 
  2119.  
  2120.  4. Select one of the predefined summary types from the list in Summary 
  2121.     expression. This step is optional. 
  2122.  
  2123.  5. Type the remainder of the expression (for example, a column name) to create 
  2124.     the summary data in the entry field in Summary expression. 
  2125.  
  2126.     See Point and click expression entry for information on how to use the 
  2127.     Expression Builder to help you create an expression. 
  2128.  
  2129.  6. Select OK. 
  2130.  
  2131. A new column containing the summary data is added to the query result. 
  2132.  
  2133.  
  2134. ΓòÉΓòÉΓòÉ 10.7. Selecting data from a partial query ΓòÉΓòÉΓòÉ
  2135.  
  2136. When you define a query using a semi join, an except join or an outer join, it 
  2137. can be useful to make data selections from part of a query, rather than from 
  2138. the entire query. For example, you could make data selections from the first 
  2139. part of a query before linking it with an except join to another data source. 
  2140. This gives you considerably greater accuracy in specifying the result of the 
  2141. except join, and can save you time by avoiding the use of an embedded query. 
  2142.  
  2143. By selecting Advanced options from the View menu, you can: 
  2144.  
  2145. o Select data from a partial query. Most of the data selection choices from the 
  2146.   Query menu are added to the Selected menu. 
  2147.  
  2148. o Link a data source to itself. 
  2149.  
  2150. To select data from a partial query: 
  2151.  
  2152.  1. Select the data source at the end of the partial query. 
  2153.  
  2154.  2. Select the data selections you want from the Selected menu. For example, 
  2155.     you can select Select rows from the Selected menu. 
  2156.  
  2157.     The selections you make are applied to the partial query as if it were a 
  2158.     complete query. 
  2159.  
  2160.  
  2161. ΓòÉΓòÉΓòÉ 10.8. Making a query reusable ΓòÉΓòÉΓòÉ
  2162.  
  2163. You can make a query more flexible by using variable values in its definition. 
  2164. You tell QUERY FOR OS/2 which values to use for the variables when the query is 
  2165. run. 
  2166.  
  2167. For example, suppose you created a simple query to provide the address of a 
  2168. given customer. You would use this query each time you wanted to find a 
  2169. customer's address, but it would be tedious to have to open the query and 
  2170. change the row selection expression every time. 
  2171.  
  2172. By using a variable value in the row selection expression, however, you can 
  2173. specify the customer name you want each time you run the query. Suppose you 
  2174. typed the following row selection expression: "COMPANY" = `@Customer_name` 
  2175.  
  2176. Now each time you run this query, the Value Substitution window is displayed. 
  2177.  
  2178. Type the customer name of your choice, and select OK. The variable value in the 
  2179. query definition is replaced with the name you type before the data is 
  2180. retrieved. 
  2181.  
  2182.  
  2183. ΓòÉΓòÉΓòÉ 10.8.1. Naming variable values ΓòÉΓòÉΓòÉ
  2184.  
  2185. A variable value must consist of an @ character followed by up to 20 
  2186. characters. The characters must comprise alphanumeric characters or the 
  2187. underscore character. The first character after the @ cannot be a number. 
  2188. Spaces cannot be used within the variable. For example: 
  2189.  
  2190. Valid                         Not valid 
  2191. @var1                         @%1 
  2192. @Customer_number              @Customer number 
  2193. @Address1                     @1Address 
  2194.  
  2195. You can use any number of variable values in expressions in the Select Rows and 
  2196. Calculate Columns windows of a query. 
  2197.  
  2198.  
  2199. ΓòÉΓòÉΓòÉ 10.8.2. Making variable values easier to use ΓòÉΓòÉΓòÉ
  2200.  
  2201. Use the following tips to make your variable values user-friendly: 
  2202.  
  2203. o Use meaningful names for the variable values. 
  2204.  
  2205.   Variable values are shown next to an entry field in the Value Substitution 
  2206.   window when the query is run. It is much easier to remember what to type next 
  2207.   to a value such as "Customer_name" than a value such as "var1". 
  2208.  
  2209. o Provide a cue in the icon name. 
  2210.  
  2211.   Include a word such as "any" in the query icon name to provide a visual 
  2212.   reminder that your query asks the user to type values for its variables. For 
  2213.   example, Weekly sales comparison - any 2 products. 
  2214.  
  2215.  
  2216. ΓòÉΓòÉΓòÉ 10.9. Producing SQL using a query ΓòÉΓòÉΓòÉ
  2217.  
  2218. If you need to use an SQL SELECT statement, but are not familiar with SQL, you 
  2219. can use a query to produce the SELECT statement for you. For example, you can 
  2220. define an SQL view without writing any SQL by using a query to produce the 
  2221. required SELECT statement. 
  2222.  
  2223. To produce a SELECT statement: 
  2224.  
  2225.  1. Define a query that produces the result you want. 
  2226.  
  2227.  2. Select from the tool bar. 
  2228.  
  2229.     An SQL Statement containing the SQL produced by your query is displayed. 
  2230.     See Creating effective SQL statements for information about how to edit and 
  2231.     save the SQL statement. 
  2232.  
  2233.  3. Use the clipboard to cut and paste the SELECT statement into the window 
  2234.     where you want to use it. 
  2235.  
  2236.  
  2237. ΓòÉΓòÉΓòÉ 10.10. Importing Query Manager queries ΓòÉΓòÉΓòÉ
  2238.  
  2239. Query Manager is a query tool supplied with the IBM OS/2 Extended Services* and 
  2240. IBM DATABASE 2 OS/2 products. You can convert a prompted query produced by 
  2241. Query Manager into a Visualizer query by importing it: 
  2242.  
  2243.  1. Select Import from the Query menu. The Import window is displayed. 
  2244.  
  2245.     A list of all the SQL databases cataloged on your workstation is shown in 
  2246.     the Locations list. 
  2247.  
  2248.  2. Select a database from the Locations list. 
  2249.  
  2250.     A list of all collection names associated with the selected database is 
  2251.     shown in the Locations list. The collection name (sometimes called the 
  2252.     table prefix) is usually the same as the user ID of the person who created 
  2253.     the tables and views. 
  2254.  
  2255.  3. Select a collection name from the Locations list. 
  2256.  
  2257.     A list of queries identified by the selected collection name is shown in 
  2258.     the Names list. 
  2259.  
  2260.  4. Double-click on the query you want in the Names list. 
  2261.  
  2262.  
  2263. ΓòÉΓòÉΓòÉ 10.11. Tips on defining queries for use by others ΓòÉΓòÉΓòÉ
  2264.  
  2265. When you define queries for others to run, there are a number of tips you can 
  2266. follow to simplify both using and maintaining the queries. Some of these tips 
  2267. are more obvious than others. The following sections give a brief summary of 
  2268. them. 
  2269.  
  2270.  
  2271. ΓòÉΓòÉΓòÉ 10.11.1. Naming icons ΓòÉΓòÉΓòÉ
  2272.  
  2273. Help your users identify a query by giving the desktop icon a meaningful name. 
  2274. For example, if the query selects sales figures from tables updated weekly for 
  2275. the ten best-selling products, a good title would be Top 10 sellers - Last 
  2276. week. 
  2277.  
  2278. For information on how to change the name of an icon, see Common OS/2 tasks. 
  2279.  
  2280.  
  2281. ΓòÉΓòÉΓòÉ 10.11.2. Running an object by double-clicking ΓòÉΓòÉΓòÉ
  2282.  
  2283. If your users often run a query, but rarely or never make changes to it, you 
  2284. can make life simpler for them by changing the default Open action. Your users 
  2285. can then run the query by double-clicking on its icon. 
  2286.  
  2287. To change the default Open action: 
  2288.  
  2289.  1. Display the pop-up menu for the icon. 
  2290.  
  2291.  2. Select the arrow to the right of Open. 
  2292.  
  2293.  3. Select Settings. The query notebook is displayed. 
  2294.  
  2295.  4. Select the Menu notebook tab. 
  2296.  
  2297.  5. In the Available menus list, select ~Open. 
  2298.  
  2299.  6. Select the Settings push button. The Menu Settings window is displayed. 
  2300.  
  2301.  7. In the Default action list, select Run query. 
  2302.  
  2303.  8. Select OK and close the query notebook. 
  2304.  
  2305. Your users can still open the object in the usual way by using the pop-up menu 
  2306. for the icon. 
  2307.  
  2308.  
  2309. ΓòÉΓòÉΓòÉ 10.11.3. Preventing changes to a query ΓòÉΓòÉΓòÉ
  2310.  
  2311. If none of your users need to change the query, or if several users access the 
  2312. same icon on a LAN, you can prevent any changes by making the query a read-only 
  2313. file. 
  2314.  
  2315. To make a query a read-only file: 
  2316.  
  2317.  1. Open the settings notebook of the query. 
  2318.  
  2319.  2. Select the File notebook tab. 
  2320.  
  2321.  3. Select the right arrow at the bottom of the page to display Page 2 of the 
  2322.     File section. 
  2323.  
  2324.  4. In Flags, select Read-only, then close the notebook. 
  2325.  
  2326. Alternatively, if the query is stored on a LAN resource, you can make the 
  2327. entire resource read-only. 
  2328.  
  2329.  
  2330. ΓòÉΓòÉΓòÉ 11. Accessing data using SQL Statements ΓòÉΓòÉΓòÉ
  2331.  
  2332. Use the SQL Statement object to create, run and store an SQL Statement, and to 
  2333. view, manipulate, or print any result. You can use an SQL Statement defined by 
  2334. someone else to provide data for a report without having to know SQL yourself. 
  2335.  
  2336. You can drag and drop an SQL Statement onto the following objects: 
  2337.  
  2338. o Visualizer report 
  2339. o Folder 
  2340. o Out-basket (electronic mail) 
  2341. o Printer 
  2342. o Shredder 
  2343.  
  2344. This chapter is intended for those not familiar with SQL, and describes how to 
  2345. use an existing SQL Statement as a data source for a report, and how to run an 
  2346. SQL Statement and view the result. 
  2347.  
  2348. If you are familiar with SQL, you can define an SQL Statement to select data 
  2349. from tables and views, or to perform many routine database maintenance tasks. 
  2350. You can store your SQL Statement and allow other users, who may have no 
  2351. knowledge of SQL, to run it and use any result produced. For information on 
  2352. these tasks, see Creating effective SQL statements. 
  2353.  
  2354.  
  2355. ΓòÉΓòÉΓòÉ 11.1. Using an SQL Statement to provide data for a report ΓòÉΓòÉΓòÉ
  2356.  
  2357. You can use an SQL Statement to provide data for a report in the same way as a 
  2358. table, view or query. 
  2359.  
  2360. Drag the SQL Statement and drop it on an open report. You can drag either the 
  2361. icon of a closed SQL Statement, or the title-bar small icon of an open SQL 
  2362. Statement. The report is connected to the database specified in the SQL 
  2363. Statement and is able to access the SQL Statement result. 
  2364.  
  2365.  
  2366. ΓòÉΓòÉΓòÉ 11.2. Running an SQL Statement ΓòÉΓòÉΓòÉ
  2367.  
  2368. To run an SQL Statement without opening it: 
  2369.  
  2370.  1. Display the pop-up menu for the SQL Statement. 
  2371.  2. Select the arrow to the right of Open. 
  2372.  3. Select Run SQL. 
  2373. If Run SQL has a check mark next to it, it is the default selection on the 
  2374. cascaded menu. In this case, you can run the SQL Statement by double-clicking 
  2375. on its icon. For information on how to change the default selection on the 
  2376. cascaded menu, see Tips on defining SQL statements for use by others. 
  2377.  
  2378. To run an SQL Statement that is open for browsing or editing, select from the 
  2379. tool bar. 
  2380.  
  2381. If the SQL Statement contains a SELECT statement that runs successfully, the 
  2382. result is shown in a data browsing window. 
  2383.  
  2384. You can scroll through the data in this window, but you cannot update it. You 
  2385. can save the result as a Visualizer table or in a number of other data formats 
  2386. on the OS/2 file system. For more information, see Viewing and updating data in 
  2387. an SQL table. 
  2388.  
  2389.  
  2390. ΓòÉΓòÉΓòÉ 12. Analyzing and presenting data using reports ΓòÉΓòÉΓòÉ
  2391.  
  2392. Use a Visualizer Report object to analyze and present data from queries, SQL 
  2393. tables and views, Visualizer tables, and SQL Statements in a textual form. 
  2394. Choose the elements you want to show in your report, and change the text, 
  2395. color, size, spacing, and other settings of each report element by 
  2396. double-clicking on it. You can add headings, annotations, color and fonts to a 
  2397. report to make an eye-catching presentation to your colleagues. When you 
  2398. finish, print your report by dragging and dropping it on the printer. 
  2399.  
  2400. You can drag and drop a Visualizer report onto the following objects: 
  2401.  
  2402. o Folder 
  2403. o Out-basket (electronic mail) 
  2404. o Printer 
  2405. o Shredder 
  2406.  
  2407. This chapter describes how to select and group data in a report, how to analyze 
  2408. the data in different ways, how to make a report more attractive, and how to 
  2409. print and save a report. 
  2410.  
  2411.  
  2412. ΓòÉΓòÉΓòÉ 12.1. Selecting data for your report ΓòÉΓòÉΓòÉ
  2413.  
  2414. You can use one of the following data sources to create a report: 
  2415.  
  2416. o An SQL table 
  2417. o An SQL view 
  2418. o A Visualizer query 
  2419. o An SQL statement 
  2420. o A Visualizer table 
  2421. o A file stored in the OS/2 file system in a supported data format 
  2422. o An Application System (AS) table, or a table that can be accessed using AS 
  2423.  
  2424. To use more than one data source in a report, create a query that combines the 
  2425. data sources, then use the query to create your report. 
  2426.  
  2427.  
  2428. ΓòÉΓòÉΓòÉ 12.1.1. Selecting data source icons ΓòÉΓòÉΓòÉ
  2429.  
  2430. Usually, you can see the icon of the data source you want. For example, it 
  2431. might be in a database object or on the desktop. 
  2432.  
  2433. To select a data source for your report when you can see its icon, drag the 
  2434. icon and drop it on an open report. 
  2435.  
  2436.  
  2437. ΓòÉΓòÉΓòÉ 12.1.2. Finding data sources for your report ΓòÉΓòÉΓòÉ
  2438.  
  2439. Sometimes you may not be able to see the icon of the data source you want. It 
  2440. might not exist on your workstation, or you might not know where it is. 
  2441.  
  2442. If you cannot find the icon you want, select from the tool bar. The Select a 
  2443. Table or Query window is displayed. 
  2444.  
  2445. Use the Select a Table or Query window to find data sources on the OS/2 file 
  2446. system, and to find other data sources that have been cataloged on your 
  2447. workstation. 
  2448.  
  2449. To select a table or a view from an SQL database: 
  2450.  
  2451.  1. Ensure that SQL is selected in the Type list. (SQL is the default 
  2452.     selection). 
  2453.  
  2454.     A list of all the SQL databases that you have cataloged on your workstation 
  2455.     is shown in the Locations list. 
  2456.  
  2457.  2. Select a database in the Locations list. 
  2458.  
  2459.     A list of all collection names associated with the selected database is 
  2460.     shown in the Locations list. The collection name (sometimes called the 
  2461.     table prefix) is usually the same as the user ID of the person who created 
  2462.     the tables and views. 
  2463.  
  2464.  3. Select a collection name in the Locations list. 
  2465.  
  2466.     A list of tables and views identified by the selected collection name is 
  2467.     shown in the Names list. 
  2468.  
  2469.  4. Double-click on the table or view you want in the Names list. 
  2470.  
  2471. For information on using the Select a Table or Query window to find data 
  2472. sources that are not stored in an SQL database, see the online help for the 
  2473. window. 
  2474.  
  2475.  
  2476. ΓòÉΓòÉΓòÉ 12.1.3. Selecting columns for a report ΓòÉΓòÉΓòÉ
  2477.  
  2478. You do not have to show all of the columns in a data source in your report. You 
  2479. can select specific columns to show. The other columns are still available to 
  2480. use when creating text variables and calculated columns, or when selecting or 
  2481. ordering rows. 
  2482.  
  2483. To select columns: 
  2484.  
  2485.  1. Select from the tool bar. 
  2486.  
  2487.  2. In the Report columns list, select the check boxes next to the names of the 
  2488.     columns you want shown in your report. The columns are displayed across the 
  2489.     report in the order in which you select them. 
  2490.  
  2491.  3. Select OK. 
  2492.  
  2493.  
  2494. ΓòÉΓòÉΓòÉ 12.1.4. Selecting rows for a report ΓòÉΓòÉΓòÉ
  2495.  
  2496. Just as you can choose to show only some of the columns in the data source, you 
  2497. can also choose to select only some of the rows of data. You might want to 
  2498. select rows because: 
  2499.  
  2500. o You are only interested in certain items in the data, and don't want to look 
  2501.   at all the items. For example, you have data about lots of products, but are 
  2502.   only interested in those sold under a specific brand name. 
  2503.  
  2504. o You want to highlight items that need your attention. For example, it would 
  2505.   be useful to know which of your account customers have not paid their bills 
  2506.   for more than 3 months. 
  2507.  
  2508. o You want to look at data that has so many rows that it would need more memory 
  2509.   than you have in your workstation. For example, you have a huge mainframe 
  2510.   database of daily sales figures for stores in major cities across the 
  2511.   country. You can look at the data for each city in turn, or for each separate 
  2512.   product line countrywide. 
  2513.  
  2514. o You want to use only a sample of data to save time while designing your 
  2515.   report. Although you could do this by explicitly selecting rows, a simpler 
  2516.   way is described in Redrawing a report faster. 
  2517.  
  2518. To select rows: 
  2519.  
  2520.  1. Select from the tool bar. The Select Rows window is displayed. 
  2521.  
  2522.  2. Type an expression that specifies the rows you want. 
  2523.  
  2524.     For example, the expression shown above specifies that only rows where the 
  2525.     depot is New York or Montreal should be selected. 
  2526.  
  2527.     Type your expression using the syntax indicated in brackets above the 
  2528.     Expression field. If you aren't familiar with the syntax indicated, see 
  2529.     Point and click expression entry. 
  2530.  
  2531.  3. In the Select Rows window, select OK. 
  2532.  
  2533.  
  2534. ΓòÉΓòÉΓòÉ 12.2. Grouping data in your report ΓòÉΓòÉΓòÉ
  2535.  
  2536. You can make your report more useful by arranging the data into meaningful 
  2537. groups. 
  2538.  
  2539. Grouping data means ordering it so that rows having the same value in a 
  2540. specified column are shown together in a contiguous block or group. Grouping 
  2541. data makes the data easier to read, because related items are shown together in 
  2542. the same place. 
  2543.  
  2544. The column you specify to order data in this way is referred to as the column 
  2545. controlling the group. When the data has been ordered, whenever the value in 
  2546. this column changes, a new group is created. Because of this, groups are often 
  2547. referred to by the common value they share. For example, the "Department 40" 
  2548. group. 
  2549.  
  2550. Totals and other data analyses, when specified, are calculated at the end of 
  2551. the appropriate groups. However, they always use data from columns that do not 
  2552. control groups. 
  2553.  
  2554. For example, if you are creating a report from personnel data, it might be 
  2555. useful to group staff by division, then by department within that division, and 
  2556. then by job title within that department. Providing you have columns set up for 
  2557. Division, Department, and Job Title, you can create these groups in your report 
  2558. regardless of the order of the original data. 
  2559.  
  2560. In this example, you might want to see the total salary for each department in 
  2561. your report. The total salary is calculated whenever the value in the 
  2562. Department column changes, and a new group begins. However, the total uses data 
  2563. from the Salary column, which does not control grouping in the report. 
  2564.  
  2565. You can group data down or across your report. 
  2566.  
  2567.  
  2568. ΓòÉΓòÉΓòÉ 12.2.1. Grouping data down ΓòÉΓòÉΓòÉ
  2569.  
  2570. Grouping data down a report means that when a new group is started, it is shown 
  2571. below the preceding group, after any totals for that group. Most reports group 
  2572. data in this way. You can specify up to five columns to control grouping down a 
  2573. report. 
  2574.  
  2575. To group data down a report: 
  2576.  
  2577.  1. Select from the tool bar. The Select Columns and Define Groups window is 
  2578.     displayed. 
  2579.  
  2580.  2. In Columns controlling groups down, select a column to control grouping in 
  2581.     the Group 1 list. 
  2582.  
  2583.  3. If you want your data to be ordered into more than one level of grouping, 
  2584.     select the columns you want to control the grouping from the appropriate 
  2585.     Group lists. The second and subsequent levels of grouping are nested within 
  2586.     the preceding level. 
  2587.  
  2588.  4. Select OK. 
  2589.  
  2590. As well as creating up to five levels of grouping down your report, you can 
  2591. also create one level of grouping across the report. 
  2592.  
  2593.  
  2594. ΓòÉΓòÉΓòÉ 12.2.2. Grouping data across ΓòÉΓòÉΓòÉ
  2595.  
  2596. Like data that is grouped down a report, data that is grouped across causes a 
  2597. new group to be started, and totals to be calculated, whenever there is a 
  2598. change in the value of the column that controls the grouping. When data is 
  2599. grouped across, a new group is shown to the right of  the preceding group, 
  2600. after any totals for that group. 
  2601.  
  2602. For example, if you group across on a column called Sex, your report will show 
  2603. separate totals across the page for Male and Female, and a further total for 
  2604. both sexes. This arrangement means that you can combine a group across with one 
  2605. or more levels of grouping down to produce a cross-tabular report. 
  2606.  
  2607. To create a group across a report: 
  2608.  
  2609.  1. Select from the tool bar. The Select Columns and Define Groups window is 
  2610.     displayed. 
  2611.  
  2612.  2. Select a column from the list in Column controlling a group across. Only 
  2613.     one column can be used to control grouping across a report. 
  2614.  
  2615.     Grouping across causes the report to become a summary report. A summary 
  2616.     report shows only totals for groups, rather than information from 
  2617.     individual rows in the data. Because of this, you must select some totals, 
  2618.     or there will be nothing to show in your report. 
  2619.  
  2620.  3. Select the Set column totals push button. The Column Totals Settings window 
  2621.     is displayed. 
  2622.  
  2623.  4. Select the total types you want for each column. For more information, see 
  2624.     Naming variable values. 
  2625.  
  2626.  5. Select OK. 
  2627.  
  2628.  6. In the Select Columns and Define Groups window, select OK. 
  2629.  
  2630.  
  2631. ΓòÉΓòÉΓòÉ 12.3. Analyzing your data ΓòÉΓòÉΓòÉ
  2632.  
  2633. Report provides a number of calculation functions to help you analyze your 
  2634. data. You can: 
  2635.  
  2636. o Show summary information using total types such as average, high, low, count, 
  2637.   and standard deviation. 
  2638.  
  2639. o Calculate information from data in each row of the report. A calculated 
  2640.   column uses an expression you provide to calculate a new column from data in 
  2641.   existing columns. 
  2642.  
  2643. o Annotate or highlight selected rows. You can use conditional notes to 
  2644.   annotate selected rows of your report. You can also show selected rows in a 
  2645.   different color or font. 
  2646.  
  2647.  
  2648. ΓòÉΓòÉΓòÉ 12.3.1. Summarizing data using column totals ΓòÉΓòÉΓòÉ
  2649.  
  2650. To produce totals for a column in your report: 
  2651.  
  2652.  1. Select from the tool bar. The Report Settings window is displayed. 
  2653.  
  2654.  2. Select the Settings push button for Totals. 
  2655.  
  2656.  3. On the Column Totals Settings window, select Totals to use the following 
  2657.     total types: 
  2658.  
  2659.    o Sum 
  2660.    o Count 
  2661.    o High 
  2662.    o Low 
  2663.    o Average 
  2664.    o Standard deviation 
  2665.    o Calculate 
  2666.  
  2667.     Select Percentages to calculate totals as percentages. You can use 
  2668.     percentage totals in addition to any other totals. For an explanation of 
  2669.     the percentage total choices, see the online help for the window. 
  2670.  
  2671.  4. Select the name of the column you want to total in Column name. 
  2672.  
  2673.  5. Select either the Absolute or Cumulative check box for the total types you 
  2674.     want. 
  2675.  
  2676.     Absolute totals are calculated only from data in the current group in the 
  2677.     report. Cumulative totals are calculated from data in the current and all 
  2678.     preceding groups in the report. 
  2679.  
  2680.  6. Type a label to identify each total in your report. You can use any text 
  2681.     variable in your total labels. This step is optional. 
  2682.  
  2683.  7. Repeat for any other column you want to total by selecting it in Column 
  2684.     name. 
  2685.  
  2686.  8. Select OK. 
  2687.  
  2688.  9. Select OK to close the Report Settings window. 
  2689.  
  2690. The most efficient way of producing totals is to select them after you have 
  2691. selected columns and rows and defined any grouping in your report. Instead of 
  2692. closing the Select Columns and Define Groups window, select the Set column 
  2693. totals push button. 
  2694.  
  2695.  
  2696. ΓòÉΓòÉΓòÉ 12.3.2. Calculating data for new columns ΓòÉΓòÉΓòÉ
  2697.  
  2698. Use calculated columns to provide additional information from data contained in 
  2699. existing columns. For example, you can create a column which calculates an 
  2700. employee's total salary from two existing columns which show their basic salary 
  2701. and commission. This is a simple example, but you can use more complex 
  2702. expressions to formulate a calculated column. 
  2703.  
  2704. To calculate additional columns from existing ones: 
  2705.  
  2706.  1. Select from the tool bar. The Calculate Columns window is displayed. 
  2707.  
  2708.  2. Type a name for the new column in Result name. 
  2709.  
  2710.  3. Type an Expression that defines your calculated column, or use Expression 
  2711.     Builder by selecting . For further information on using Expression Builder, 
  2712.     see Point and click expression entry. 
  2713.  
  2714.  4. Select Format to control the numeric display format of your new column. 
  2715.  
  2716.  5. Select OK to close the Calculate Columns window. 
  2717.  
  2718.  
  2719. ΓòÉΓòÉΓòÉ 12.3.3. Annotating your report ΓòÉΓòÉΓòÉ
  2720.  
  2721. Use conditional notes to annotate values fulfilling a specified condition. For 
  2722. example, in a report of credit card balances, you could add the words Above 
  2723. credit limit when the value in the Balance column was higher than that in the 
  2724. Credit_Limit column. 
  2725.  
  2726. To set conditional notes: 
  2727.  
  2728.  1. Double-click on the column you want to annotate. 
  2729.  
  2730.  2. On the Column Settings window, type a Condition in the Conditional 
  2731.     presentation section of the window, or use Expression Builder by selecting 
  2732.     . 
  2733.  
  2734.  3. Type the text of your annotation in Note. 
  2735.  
  2736.  4. If you want to change the color of the data, as well as or instead of 
  2737.     showing your annotation text, select the Color push button. 
  2738.  
  2739.  5. Select either Replace value with note or Show both value and note. 
  2740.  
  2741.  6. Check that the width of the column, set in the Column elements display area 
  2742.     section of the window, is sufficient to display your text. 
  2743.  
  2744.  7. Select OK. 
  2745.  
  2746.  
  2747. ΓòÉΓòÉΓòÉ 12.4. Finding information in your report ΓòÉΓòÉΓòÉ
  2748.  
  2749. You can easily find specific pages and group totals in your report. 
  2750.  
  2751. To find a specific page or part of your report: 
  2752.  
  2753.  1. Select Find page from the Edit menu. 
  2754.  2. Type the page and part number you want to find. 
  2755.  3. Select Find. 
  2756.  
  2757. You can find the first or last page of your report more quickly by selecting 
  2758. First page or Last page from the Edit menu. 
  2759.  
  2760. To find a specific group total in your report: 
  2761.  
  2762.  1. Select Find group total from the Edit menu. 
  2763.  
  2764.  2. Type a value for the total you want to locate against the appropriate 
  2765.     column name. 
  2766.  
  2767.  3. Select Find. 
  2768.  
  2769.  
  2770. ΓòÉΓòÉΓòÉ 12.5. Adding text to your report ΓòÉΓòÉΓòÉ
  2771.  
  2772. You can make your report easier to read and understand by adding text headings 
  2773. and labels to the data. You can type text into any of the following areas of a 
  2774. report: 
  2775.  
  2776. Top title 
  2777.           Appears at the top of each page and part of your report. 
  2778.  
  2779. Column heading 
  2780.           Appears at the top of each page and part of your report, and 
  2781.           optionally, at the top and bottom of each group. 
  2782.  
  2783. Group title 
  2784.           Appears once for each group, before any column headings or details. 
  2785.  
  2786. Group total heading 
  2787.           Appears above the totals for each group. 
  2788.  
  2789. Group label 
  2790.           Appears on the left of the report, on the same line as the totals for 
  2791.           each group. 
  2792.  
  2793. Group total footer 
  2794.           Appears below the totals for each group. 
  2795.  
  2796. Bottom title 
  2797.           Appears at the bottom of each page and part of your report. 
  2798.  
  2799.  
  2800. ΓòÉΓòÉΓòÉ 12.5.1. Describing a report in top and bottom titles ΓòÉΓòÉΓòÉ
  2801.  
  2802. Top and bottom titles appear at the top and bottom of each page and part of 
  2803. your report. Use them to provide a title for your report, and to provide status 
  2804. information such as the date the report was produced, and its security 
  2805. classification. Use them also to provide page and part numbers for easy 
  2806. reference. 
  2807.  
  2808. Because the supplied Report template already includes a top title, the 
  2809. following steps describe how to add a bottom title to your report. However, the 
  2810. steps are similar in both cases. 
  2811.  
  2812. To add a bottom title to your report: 
  2813.  
  2814.  1. Select from the tool bar. 
  2815.  
  2816.     The Report Settings window is displayed. 
  2817.  
  2818.  2. Select the Settings push button for Bottom title. 
  2819.  
  2820.     The Bottom Title Settings window is displayed. 
  2821.  
  2822.  3. Type your title in Text elements. You can use text variables in any line of 
  2823.     the top title. 
  2824.  
  2825.  4. Select the Alignment for each element of the bottom title in Text element. 
  2826.  
  2827.  5. Ensure that the Display check box is selected in Bottom title. 
  2828.  
  2829.  6. Select OK. 
  2830.  
  2831.  7. Select OK to close the Report Settings window. 
  2832.  
  2833. If there is a top or bottom title on your report already, you can open its 
  2834. settings window by double-clicking on it. 
  2835.  
  2836.  
  2837. ΓòÉΓòÉΓòÉ 12.5.2. Describing columns ΓòÉΓòÉΓòÉ
  2838.  
  2839. Column headings appear as descriptive text above each column in your report. 
  2840. Use them to describe the column contents in your own words, rather than having 
  2841. to use the column names found in the original data source. 
  2842.  
  2843. To add column headings to your report: 
  2844.  
  2845.  1. Select from the tool bar. 
  2846.  
  2847.  2. Select the Settings push button for Column headings. 
  2848.  
  2849.  3. On the Column Headings Settings window, type the text you want to appear in 
  2850.     your first column heading in Heading text. 
  2851.  
  2852.  4. Select the next column for which you want to add a heading from the Column 
  2853.     name list. 
  2854.  
  2855.  5. Type the column heading text in Heading text. 
  2856.  
  2857.  6. Repeat steps 4 and 5 for each column for which you want a heading. 
  2858.  
  2859.  7. Choose how often you want the column headings to appear in your report by 
  2860.     selecting an option in Headings for all columns. 
  2861.  
  2862.  8. Select OK. 
  2863.  
  2864.  9. Select OK to close the Report Settings window. 
  2865.  
  2866. If there are column headings already in your report, you can change their 
  2867. settings by double-clicking on them. 
  2868.  
  2869.  
  2870. ΓòÉΓòÉΓòÉ 12.5.3. Describing a group ΓòÉΓòÉΓòÉ
  2871.  
  2872. Group titles appear at the top of each group, before any column headings or 
  2873. details for the group. Use them to describe the group. 
  2874.  
  2875. To add group titles to your report: 
  2876.  
  2877.  1. Select from the tool bar. 
  2878.  
  2879.  2. Select the Settings push button for Groups down. 
  2880.  
  2881.  3. Select the Settings push button for Group title. 
  2882.  
  2883.  4. On the Group Title Settings window, select the group you want to title from 
  2884.     the Group list. 
  2885.  
  2886.  5. Type your group title in Text elements. You can use text variables in any 
  2887.     line of the group title. 
  2888.  
  2889.  6. Select the Alignment for each element of your group title in Text element. 
  2890.  
  2891.  7. Ensure that the Display check box is selected in Group title. 
  2892.  
  2893.  8. Select OK. 
  2894.  
  2895.  9. Select OK to close the Report Settings window. 
  2896.  
  2897. If there is a group title already in your report, you can change its settings 
  2898. by double-clicking on it. 
  2899.  
  2900. You can use text variables that represent the grouping level of the column 
  2901. effectively in the text of group titles. For details, see Summarizing data 
  2902. using column totals. 
  2903.  
  2904.  
  2905. ΓòÉΓòÉΓòÉ 12.5.4. Describing totals ΓòÉΓòÉΓòÉ
  2906.  
  2907. A group total area appears below each group when you have selected totals for 
  2908. one or more columns. Text in total labels or column headings can appear in a 
  2909. group total area, but the text must be identical for all group total areas in 
  2910. your report. You can type text that is specific to each group total area in any 
  2911. of the following areas: 
  2912.  
  2913. o Group total heading 
  2914. o Group total label 
  2915. o Group total footer 
  2916.  
  2917. Few reports need to use all three of these at the same time. Use those that 
  2918. allow you to position your text where you need it. 
  2919.  
  2920.  
  2921. ΓòÉΓòÉΓòÉ 12.6. Changing fonts ΓòÉΓòÉΓòÉ
  2922.  
  2923. You can change the font of any text or data in your report to one of the 
  2924. following: 
  2925.  
  2926. o Courier 
  2927. o Times Roman 
  2928. o Helvetica 
  2929.  
  2930. You can also choose to add any combination of bold, italic or outline emphasis 
  2931. to any report element. 
  2932.  
  2933. To change the font or emphasis of a report element: 
  2934.  
  2935.  1. Select the element you want to change. 
  2936.  
  2937.  2. Select Font from the Selected menu. The Font window is displayed. 
  2938.  
  2939.  3. Select the font you want from the list, and select any combination of 
  2940.     emphasis check boxes. An example of how your text will look is shown. 
  2941.  
  2942.  4. Select OK. 
  2943.  
  2944.  5. Click on the report element to deselect it. 
  2945. A Font push button appears on most of the windows in which you can enter text. 
  2946. Select it to choose a font as you enter your text. To change the size of the 
  2947. fonts used in your report, use the tool bar buttons. Select to decrease the 
  2948. size of the fonts, and to increase the size of the fonts. Each time you click 
  2949. on one of the buttons, the font size is changed by approximately 20%. 
  2950.  
  2951.  
  2952. ΓòÉΓòÉΓòÉ 12.7. Adding color to your report ΓòÉΓòÉΓòÉ
  2953.  
  2954. Use color in combination with font and emphasis to highlight information in 
  2955. your report. 
  2956.  
  2957. To change the color of any report element: 
  2958.  
  2959.  1. Select the report element. 
  2960.  
  2961.  2. Select Color from the Selected menu. The Color window is displayed. 
  2962.  
  2963.  3. Change the background, foreground or outline of the selected report element 
  2964.     by selecting a radio button and then selecting the color you want. 
  2965.  
  2966.  4. Select OK. 
  2967.  
  2968.  5. Click on the report element to deselect it. 
  2969.  
  2970.  
  2971. ΓòÉΓòÉΓòÉ 12.8. Changing text in your report ΓòÉΓòÉΓòÉ
  2972.  
  2973. When you open a report, it retrieves the latest data from the data source you 
  2974. have selected. Because the report always shows the latest information, it is 
  2975. sometimes useful to be able to update the text in titles and labels in the 
  2976. report to suit the data. 
  2977.  
  2978. The following sections describe two ways of changing report text by using 
  2979. variables. A variable is a place-holder for text that changes. The actual text 
  2980. is updated each time the report is started. 
  2981.  
  2982.  
  2983. ΓòÉΓòÉΓòÉ 12.8.1. Including data in text ΓòÉΓòÉΓòÉ
  2984.  
  2985. Text variables take the form of an underscore character followed by a number. 
  2986. You can type them in any text area of the report (except in column headings) 
  2987. just like normal text. When the report is opened, the text variable is replaced 
  2988. by the actual text that it represents. There are predefined text variables for 
  2989. text such as the current date, time, and page number. The current value in any 
  2990. grouping column is also available as a predefined text variable. For example, 
  2991. in a report grouped by Region and then by Division, _1 would give the current 
  2992. value (such as North East) in the Region column, and _2 would give the current 
  2993. value in the Division column. 
  2994.  
  2995. You can use text variables that represent the grouping level of the column 
  2996. effectively in the text of group titles. Suppose you had a personnel report of 
  2997. salaries and commissions, grouped down by Region, then by Division, and finally 
  2998. by Department. The following text in a group title would give anyone reading 
  2999. the report for the first time a clear idea of what the figures represent: 
  3000.  
  3001. Salaries and commission for Computing Department, Division 40
  3002.                                             North-West Region
  3003.  
  3004. To achieve this, type the following in Text elements in the Group Title 
  3005. Settings window: 
  3006.  
  3007. Salaries and commission for _3 Department, Division _2
  3008.                                              _1 Region
  3009.  
  3010. For more information on text variables, see the online help for the Report 
  3011. object. 
  3012.  
  3013.  
  3014. ΓòÉΓòÉΓòÉ 12.8.2. Changing text when starting a report ΓòÉΓòÉΓòÉ
  3015.  
  3016. If you use a report with data that is regularly updated, you might also want to 
  3017. change the text used in the report to reflect the latest data. For example, if 
  3018. you used the same report each month to show your five best-selling products, 
  3019. you would want to change the name of the month in the top title of the report. 
  3020. You could do this by opening the report, and changing the text in the Top Title 
  3021. Settings window. However, if there are several report elements you want to 
  3022. change regularly, there is an easier way. 
  3023.  
  3024. When you type text elements, you can use variable values in the text. These 
  3025. take the form of an @ character, followed by an alphabetic character and up to 
  3026. 19 other characters, not including a space. For example, @Month 
  3027.  
  3028. When you open a report in which you have used variable values, the Value 
  3029. Substitution window opens. Use this window to specify the actual text you want 
  3030. to use in your report. Using variable values enables you to save time by typing 
  3031. all the text you want to update in one window. For more information on variable 
  3032. values, see Making a query reusable and Making variable values easier to use. 
  3033.  
  3034.  
  3035. ΓòÉΓòÉΓòÉ 12.9. Including your report in a document ΓòÉΓòÉΓòÉ
  3036.  
  3037. If you included your report in a word-processed document, it would be tedious 
  3038. to update the document each time the report changed. However, if your word 
  3039. processing software supports dynamic data exchange (DDE), you can update your 
  3040. document automatically, without leaving the Report window. 
  3041.  
  3042. To include your report in a document: 
  3043.  
  3044.  1. If anything is selected in the report, click on it to deselect it. 
  3045.  
  3046.  2. In the Report window, select Copy from the Edit menu. 
  3047.  
  3048.  3. Click on an insertion point for your report in the word processor document. 
  3049.  
  3050.  4. Select Paste link or Paste special from the word processor's Edit menu. 
  3051.  
  3052.     The exact method for creating a DDE link varies between different software 
  3053.     products, although this step will work for most. If you cannot see these 
  3054.     menu choices, see the documentation for your word processing software. 
  3055.  
  3056. To update the report in the document, select Refresh clients from the report's 
  3057. Edit menu. 
  3058.  
  3059.  
  3060. ΓòÉΓòÉΓòÉ 12.10. Tips to speed up report creation ΓòÉΓòÉΓòÉ
  3061.  
  3062. There are several ways to define a report faster. You will probably find your 
  3063. own shortcuts as you work, but this section gives some suggestions to get you 
  3064. started. 
  3065.  
  3066.  
  3067. ΓòÉΓòÉΓòÉ 12.10.1. Retrieving data faster ΓòÉΓòÉΓòÉ
  3068.  
  3069. It is much quicker to make any row selections for your report before selecting 
  3070. columns. To do this, use the Select rows push button in the Select Columns and 
  3071. Define Groups window before selecting OK or Set column totals. 
  3072.  
  3073. In some cases, particularly with remote databases, it is also quicker to create 
  3074. any calculated columns by selecting from the tool bar before using the Select 
  3075. Columns and Define Groups window. 
  3076.  
  3077.  
  3078. ΓòÉΓòÉΓòÉ 12.10.2. Changing a report layout quickly ΓòÉΓòÉΓòÉ
  3079.  
  3080. When designing your report layout, use the following tips to speed your work. 
  3081.  
  3082.  
  3083. ΓòÉΓòÉΓòÉ 12.10.2.1. Changing report settings quickly ΓòÉΓòÉΓòÉ
  3084.  
  3085. You can easily change the position, text, and other settings of a report 
  3086. element simply by double-clicking on it. For example, if you want to change the 
  3087. your report's top title, just double-click on it. The Top Title Settings window 
  3088. is displayed, and you can type your new title in the Text element list. You can 
  3089. double-click on any report element, including totals and separators. 
  3090.  
  3091. If you need to change the settings for several column-related report elements, 
  3092. such as column headings or group total areas, you can save time by making all 
  3093. the changes in the same window. 
  3094.  
  3095. To change the text for several column headings: 
  3096.  
  3097.  1. Double-click on the nearest column heading, even if it is one you do not 
  3098.     want to change. 
  3099.  
  3100.  2. In the Column Heading Settings window, select the first column for which 
  3101.     you want to change the heading settings in the Column name list. 
  3102.  
  3103.  3. Make your changes to the settings. 
  3104.  
  3105.  4. Select the next column in the Column name list. 
  3106.  
  3107.  5. Change the settings. 
  3108.  
  3109.  6. Repeat steps 4 and 5 for all the column headings you want to change. 
  3110.  
  3111.  7. When you have changed the settings for the final column heading, select OK. 
  3112.  
  3113.  
  3114. ΓòÉΓòÉΓòÉ 12.10.2.2. Redrawing a report faster ΓòÉΓòÉΓòÉ
  3115.  
  3116. If you want to see the effect of each change you make to your report layout as 
  3117. you are designing it, use a small sample of your table or query. The report is 
  3118. then redrawn faster. 
  3119.  
  3120. To use sample data for your report: 
  3121.  
  3122.  1. Select Open settings from the Report menu. 
  3123.  
  3124.  2. In the Report Settings window, select Show sample only, and type in the 
  3125.     number of rows of your table or query that you want to work with. 
  3126.  
  3127.  3. Select OK. 
  3128.  
  3129. Remember to deselect Show sample only before producing your final report. 
  3130.  
  3131.  
  3132. ΓòÉΓòÉΓòÉ 12.10.2.3. Preventing a report being redrawn ΓòÉΓòÉΓòÉ
  3133.  
  3134. If you are making a number of changes to the layout of your report and do not 
  3135. need to see the effect of each individual change, deselect Autorefresh report 
  3136. from the View menu. This prevents the report from being redrawn each time you 
  3137. make a change. 
  3138.  
  3139. To see what your changes look like, either select Refresh report from the View 
  3140. menu to refresh manually, or select Autorefresh report again. 
  3141.  
  3142.  
  3143. ΓòÉΓòÉΓòÉ 12.11. Importing Query Management Facility forms ΓòÉΓòÉΓòÉ
  3144.  
  3145. If you use Query Management Facility (QMF), you can save time by using the 
  3146. formatting options in existing QMF forms as the basis for your Visualizer 
  3147. report layouts. The QMF form is converted as accurately as possible into an 
  3148. equivalent Visualizer report. 
  3149.  
  3150. You can import a QMF form created with QMF version 2.4 or later into a 
  3151. Visualizer report, provided that the form is stored in the OS/2 file system. To 
  3152. import a form from an earlier version of QMF, export the form again from one of 
  3153. the supported versions of QMF. 
  3154.  
  3155. To import a QMF form: 
  3156.  
  3157.  1. Select a data source for your report. The Select Columns and Define Groups 
  3158.     window is displayed. 
  3159.  
  3160.  2. Select Cancel 
  3161.  
  3162.  3. Select Import from the Report menu. 
  3163.  
  3164.     The Import Format window opens. 
  3165.  
  3166.  4. Select QMF form. 
  3167.  
  3168.  5. Select Import. The Import window is displayed. 
  3169.  
  3170.  6. Select the database in which the form is stored. 
  3171.  
  3172.  7. Select the collection name used for the form. 
  3173.  
  3174.  8. Select the name of the form. 
  3175.  
  3176.  9. Select OK. 
  3177.  
  3178. For further information on importing QMF forms, see Using QMF forms with Query 
  3179. for OS/2. 
  3180.  
  3181.  
  3182. ΓòÉΓòÉΓòÉ 12.12. Printing your report ΓòÉΓòÉΓòÉ
  3183.  
  3184. To print a report, drag it and drop it on a printer object. You can drag either 
  3185. the icon of a closed report, or the title-bar small icon of an open report. You 
  3186. are not asked to provide any printing options unless you have selected the Job 
  3187. dialog before print check box in the printer object's settings notebook. 
  3188.  
  3189. Alternatively, you can: 
  3190.  
  3191.  1. Select Print from the Report menu. 
  3192.  
  3193.     If you have deselected Review printing options in the QUERY FOR OS/2 
  3194.     Profile notebook, your report is now printed using the OS/2 default 
  3195.     printer. If Review printing options is selected (this is the default 
  3196.     setting), the Print Settings window is displayed. 
  3197.  
  3198.  2. On the Print Settings window, choose whether to print the whole report, a 
  3199.     sample of the report, or just the current page. By selecting Sample only, 
  3200.     you can specify a limited number of rows from the start of your data table. 
  3201.     This enables you to save time and paper by printing a small test report 
  3202.     before using all of your data. 
  3203.  
  3204.  3. Select a radio button in Pagination to choose whether you want the report 
  3205.     page settings or the printer form settings to determine the pagination of 
  3206.     your report. 
  3207.  
  3208.  4. Select OK. The Printer Selection window is displayed. 
  3209.  
  3210.  5. Select a printer or plotter from Printers. 
  3211.  
  3212.  6. Select Print. The Print Copies window is displayed. 
  3213.  
  3214.  7. Type the number of copies (1 through 99) you want to print. 
  3215.  
  3216.  8. Use Options to change settings which are specific to your printer, such as 
  3217.     the paper feed, size, orientation, or the print resolution. When you have 
  3218.     selected the options you require, select Print on the Print Copies window. 
  3219.  
  3220.  
  3221. ΓòÉΓòÉΓòÉ 12.13. Saving your report ΓòÉΓòÉΓòÉ
  3222.  
  3223. You can save your report in one of four ways: 
  3224.  
  3225. o As a Visualizer report 
  3226.  
  3227.   Your report layout is saved, together with the name and location of the data 
  3228.   source used. The data itself is not saved, and when you next open this report 
  3229.   it will show the most up-to-date information from the data source. 
  3230.  
  3231.   To save your report with its current file name and location, select Save from 
  3232.   the Report menu. 
  3233.  
  3234.   To save your report with a different file name, or in a different location: 
  3235.  
  3236.     1. Select Copy to from the Report menu. 
  3237.     2. Type a new location and file name for your report. 
  3238.     3. Select Visualizer report in Format. 
  3239.     4. Select OK. 
  3240.  
  3241. o As a plain (ASCII) text file. 
  3242.  
  3243.   Your report, including all of the current information it is displaying from 
  3244.   the table or query, is saved in a form that can be used with other objects, 
  3245.   such as a word processor or spreadsheet. When you next use this report it 
  3246.   will show the same data as when you saved it. This format saves only the text 
  3247.   and spacing of the report. Colors, outlines, and fonts are not saved. 
  3248.  
  3249. o As a print file 
  3250.  
  3251.   The same as a plain text file, but with commands added to tell your printer 
  3252.   when to start a new page. 
  3253.  
  3254. o As a results table. 
  3255.  
  3256.   Only the totals (such as sum and count) in your report are saved, in a 
  3257.   Visualizer table. A results table is a compact way of saving summaries of 
  3258.   reports based on frequently updated data. 
  3259.  
  3260.   You can save your report as a Visualizer report results table only if your 
  3261.   report has totals selected from the Column Totals Settings window. 
  3262.  
  3263. To save your report as a plain text file or results table: 
  3264.  
  3265.  1. Select Copy to from the Report menu. 
  3266.  2. Type a location and file name for the plain text file or results table. 
  3267.  3. Select the Format your report will be saved in. 
  3268.  4. Select OK. 
  3269.  5. If you are saving your report as a plain text file: 
  3270.  
  3271.     a) Select a pagination method for your report in Page size. 
  3272.     b) Select OK. 
  3273.  
  3274. You can save your report in any of the four formats as many times as you want. 
  3275. If you do save more than once, remember to use a different file name each time. 
  3276.  
  3277.  
  3278. ΓòÉΓòÉΓòÉ 13. Choosing the best report for your data ΓòÉΓòÉΓòÉ
  3279.  
  3280. Visualizer Report enables you to create many different report layouts so that 
  3281. you can analyze and present your data in the most effective way. This chapter 
  3282. provides some advice on which report type to choose and describes how to create 
  3283. simple detail and summary reports, mailing labels, and spreadsheet reports from 
  3284. existing data sources. It also describes how to customize any of these types of 
  3285. report to suit your needs. 
  3286.  
  3287.  
  3288. ΓòÉΓòÉΓòÉ 13.1. Choosing an effective report for your data ΓòÉΓòÉΓòÉ
  3289.  
  3290. You can use Visualizer Report to produce the following types of report: 
  3291.  
  3292. Detail reports 
  3293.             A detail report shows data from individual rows of the data source. 
  3294.  
  3295.             Use a detail report when you need to break down an analysis to its 
  3296.             lowest level, or when you need to look up information about 
  3297.             individual items in your data. 
  3298.  
  3299. Summary reports 
  3300.             A summary report shows only totals and other summaries of data from 
  3301.             the data source. It does not show information relating to any 
  3302.             individual row of data. 
  3303.  
  3304.             Use a summary report when you want to analyze information at a 
  3305.             higher level, looking at trends in the results for groups of items 
  3306.             in your data. 
  3307.  
  3308. Cross-tabular reports 
  3309.             A cross-tabular report analyzes data in two dimensions, like a 
  3310.             spreadsheet. Totals and other summaries appear down the side and 
  3311.             along the bottom of the report. A cross-tabular report usually 
  3312.             shows only summary information, but you can create one that shows 
  3313.             details. 
  3314.  
  3315.             Use a cross-tabular report when you need to summarize your data in 
  3316.             more than one way at a time. For example, when you want to analyze 
  3317.             expenses both by category and by month. 
  3318.  
  3319. Mailing label style reports 
  3320.             A mailing label style report shows data from each row as a block 
  3321.             taking up several lines of a page, instead of showing it as a 
  3322.             single line. 
  3323.  
  3324.             Use a mailing label style report to produce mailing labels or 
  3325.             record cards. 
  3326.  
  3327. Customized reports 
  3328.             A customized report is a nontabular, free-form report that you 
  3329.             design yourself. You can create a customized report from any of the 
  3330.             above types of report simply by moving columns and column headings 
  3331.             to different positions. 
  3332.  
  3333.             Use a customized report when you need information laid out in a 
  3334.             specific, nontabular format. 
  3335.  
  3336.  
  3337. ΓòÉΓòÉΓòÉ 13.2. Creating a detail report ΓòÉΓòÉΓòÉ
  3338.  
  3339. A detail report shows data from individual rows of your data source. For 
  3340. example, a detail report of employee data would contain a line for each 
  3341. individual employee. This example shows you how to create a detail report that 
  3342. groups your data into relevant sections, with totals for each section. You can 
  3343. create a detail report in just six basic steps: 
  3344.  
  3345.  1. Create a new report, and rename it. See Common OS/2 tasks for information 
  3346.     on how to do this. 
  3347.  
  3348.  2. Open the report. 
  3349.  
  3350.  3. Select a data source for your report by dragging its icon and dropping it 
  3351.     on the report. The Select Columns and Define Groups window is displayed. 
  3352.  
  3353.     If you cannot find an icon for the data source you want, see Finding data 
  3354.     sources for your report. 
  3355.  
  3356.  4. In the Report columns list, select the check boxes next to the names of the 
  3357.     columns you want shown in your report. 
  3358.  
  3359.     Columns are displayed in the report from left to right in the order in 
  3360.     which you select them. 
  3361.  
  3362.  5. Group the data down your report by selecting one or more columns from the 
  3363.     lists in Columns controlling groups down. For an explanation of data 
  3364.     grouping, see Grouping data in your report. 
  3365.  
  3366.  6. Select any total types you want from the Column Totals Settings window. To 
  3367.     open this window, select the Set column totals push button. 
  3368.  
  3369.     For more information about using this window, see 
  3370.  
  3371. An example of the kind of report that is produced is shown below. You can 
  3372. fine-tune your report further by double-clicking on any report element and 
  3373. making the changes you want. For example, to give the report a more meaningful 
  3374. top title, such as Employee Salaries by Division, double-click on the top title 
  3375. and retype the text. 
  3376.  
  3377.  
  3378. ΓòÉΓòÉΓòÉ 13.3. Creating a simple summary report ΓòÉΓòÉΓòÉ
  3379.  
  3380. A summary report shows an analysis of data from individual rows in your data 
  3381. source, but does not show individual rows from the data. For example, a summary 
  3382. report of employee data might show the average salary and total salary bill for 
  3383. each department, but it would not show the salaries of individual employees. 
  3384.  
  3385. To create a simple summary report: 
  3386.  
  3387.  1. Create a detail report as described in Ensure that you select the total 
  3388.     types you want to show in your summary report. 
  3389.  
  3390.  2. Select from the tool bar. The Report Settings window is displayed. 
  3391.  
  3392.  3. In the Report Settings window, deselect the Display check box for Detail 
  3393.     area. 
  3394.  
  3395.  4. Select OK. 
  3396.  
  3397. Your report is redrawn, showing only the totals you selected. 
  3398.  
  3399.  
  3400. ΓòÉΓòÉΓòÉ 13.4. Converting a detail report to a summary report ΓòÉΓòÉΓòÉ
  3401.  
  3402. Using any detail reports you have, you can quickly create summary reports to 
  3403. help you spot trends and stay focused on the big picture. 
  3404.  
  3405. You can create a summary report from a detail report in two ways: 
  3406.  
  3407. o By creating a simple summary report: 
  3408.  
  3409.     1. Select from the tool bar. 
  3410.     2. Deselect the Display check box for Detail area. 
  3411.     3. Select OK. The report layout remains the same, but no details are shown. 
  3412.  
  3413. o By creating a cross-tabular report: 
  3414.  
  3415.     1. Select from the tool bar. 
  3416.  
  3417.     2. Select a column in the list for Column controlling a group across. If 
  3418.        the column you require is not in the list, you must first deselect it in 
  3419.        Columns controlling groups down by selecting (none) in the Group list 
  3420.        that contains your chosen column name. 
  3421.  
  3422.        If you are unsure which column to choose, try using the one that 
  3423.        contains the fewest unique values. For example, a column called Sex can 
  3424.        contain only two possible values: male or female. 
  3425.  
  3426.     3. Select OK. 
  3427.  
  3428. No details are shown, but text and totals are preserved in the cross-tabular 
  3429. report. 
  3430.  
  3431.  
  3432. ΓòÉΓòÉΓòÉ 13.5. Creating a cross-tabular report ΓòÉΓòÉΓòÉ
  3433.  
  3434. This section explains how to create a cross-tabular summary report by grouping 
  3435. data across the report. For information on how to create a cross-tabular detail 
  3436. report, see Creating a financial report. 
  3437.  
  3438. A cross-tabular report can have totals in two dimensions. For example, the 
  3439. report below shows the number of parts in stock at each depot. If you scrolled 
  3440. to the right of the report, you would see totals for the number of parts (of 
  3441. all types) in each depot. If you scrolled to the bottom of the report, you 
  3442. would see totals for the number of each part in all depots. In the bottom right 
  3443. corner of the report, you would see the grand total of all parts in all depots. 
  3444.  
  3445. This section explains how to create a cross-tabular summary report by grouping 
  3446. data across the report. For information on how to create a cross-tabular detail 
  3447. report, see Creating a financial report. 
  3448.  
  3449. To create a cross-tabular summary report: 
  3450.  
  3451.  1. Create a new report and rename it. 
  3452.  
  3453.  2. Open the report. 
  3454.  
  3455.  3. Select a data source for your report. The Select Columns and Define Groups 
  3456.     window is displayed. 
  3457.  
  3458.  4. In the Select Columns and Define Groups window, select the columns you want 
  3459.     shown in your report. As a minimum, select the following three columns: 
  3460.  
  3461.    o The column corresponding to the category you want to analyze across the 
  3462.      report. In the picture below, this is the PARTNO column. 
  3463.  
  3464.    o The column corresponding to the category you want to analyze down the 
  3465.      report. In the picture below, this is the DEPOT column. 
  3466.  
  3467.    o The column containing the numerical information you want to analyze. In 
  3468.      the picture below, this is the STOCK column. 
  3469.  
  3470.  5. Group the data down and across your report. Select the columns 
  3471.     corresponding to the two categories by which you want to analyze your data. 
  3472.  
  3473.  6. Select the Set column totals push button, then select the totals you 
  3474.     require in the Column Totals Settings window. You must select at least one 
  3475.     total type, or there will be nothing in your report to display. In the 
  3476.     example shown, the Sum total type is selected for the STOCK column. 
  3477.  
  3478.  7. In the Column Totals Settings window, select OK. 
  3479.  
  3480.  8. Select OK to close the Select Columns and Define Groups window. 
  3481.  
  3482.  
  3483. ΓòÉΓòÉΓòÉ 13.6. Creating mailing labels ΓòÉΓòÉΓòÉ
  3484.  
  3485. A mailing label style report can have any number of details across the page, 
  3486. and does not follow the usual tabular column and row pattern. For example, you 
  3487. can create address labels for printing on sheets of pre-cut self-adhesive 
  3488. labels. 
  3489.  
  3490. In the example that follows, the labels are printed two across and eight down 
  3491. the page, to fit a label size of 3.9 inches by 1.3 inches (99 millimeters by 34 
  3492. millimeters). This is a typical size for laser printer labels, but the report 
  3493. can be adjusted to suit most label sizes. 
  3494.  
  3495. To create a mailing label style report: 
  3496.  
  3497.  1. Create a new report and rename it. 
  3498.  
  3499.  2. Open the new report. 
  3500.  
  3501.  3. Select a data source for your report. The Select Columns and Define Groups 
  3502.     window is displayed. 
  3503.  
  3504.  4. Select the columns you want shown in your report. The first column you 
  3505.     select will become the first line of your address labels, the second column 
  3506.     will become the second line, and so on. 
  3507.  
  3508.  5. Specify how many labels you want across and down the page: 
  3509.  
  3510.     a) Select from the tool bar. 
  3511.  
  3512.     b) Select the Settings push button for Detail area. 
  3513.  
  3514.     c) In the Detail Area Settings window, select User-defined in Number of 
  3515.        detail areas in Down. 
  3516.  
  3517.     d) Type 8 in the entry field. 
  3518.  
  3519.     e) Type 3 in Number of blank lines below. 
  3520.  
  3521.     f) Select User-defined in Number of detail areas in Across. 
  3522.  
  3523.     g) Type 2 in the entry field. 
  3524.  
  3525.     h) Type 17 in Number of character spaces after. 
  3526.  
  3527.     i) Select OK. 
  3528.  
  3529.     j) Select OK to close the Report Settings window. 
  3530.  
  3531.  6. Select from the tool bar. 
  3532.  
  3533.  7. Remove any unwanted text from your report: 
  3534.  
  3535.     a) Double-click on one of the column headings, which now appear down the 
  3536.        left side of the window. 
  3537.  
  3538.     b) In the Column Headings Settings window, select None in Rotated display - 
  3539.        Headings across. 
  3540.  
  3541.     c) Select OK. 
  3542.  
  3543.     d) Double-click on the top title of your report. 
  3544.  
  3545.     e) In the Top Title Settings window, deselect the Display check box in Top 
  3546.        Title. 
  3547.  
  3548.     f) Select OK. 
  3549.  
  3550.  8. Adjust the spacing to suit your labels. 
  3551.  
  3552.     a) Select from the tool bar. The Page Settings window is displayed. 
  3553.  
  3554.     b) Select the size of your sheet of labels (for example, Letter or A4) from 
  3555.        the Paper list. 
  3556.  
  3557.     c) Select Portrait in Orientation.. 
  3558.  
  3559.     d) In Margins, select Inches. 
  3560.  
  3561.     e) Type 0.17 in Top. 
  3562.  
  3563.     f) Type 0.75 in Left. 
  3564.  
  3565.     g) Type 0 in Bottom. 
  3566.  
  3567.     h) Type 0 in Right. 
  3568.  
  3569.     i) Select OK. 
  3570.  
  3571.  
  3572. ΓòÉΓòÉΓòÉ 13.6.1. Changing the label format ΓòÉΓòÉΓòÉ
  3573.  
  3574. You can easily change this example to suit other label sizes. Use the Detail 
  3575. Area Settings window and the Page Settings window to specify the spacing 
  3576. requirements for your labels. 
  3577.  
  3578. In the Detail Area Settings window: 
  3579.  
  3580. Use:                                    To change: 
  3581.  
  3582. Number of detail areas down             The number of labels printed down one 
  3583.                                         sheet 
  3584.  
  3585. Number of blank lines below             The spacing between a label and the one 
  3586.                                         below it 
  3587.  
  3588. Number of detail areas across           The number of labels printed across one 
  3589.                                         sheet 
  3590.  
  3591. Number of character spaces after        The spacing between a label and the one 
  3592.                                         beside it 
  3593.  
  3594. In the Page Settings window: 
  3595.  
  3596. Use:                     To change: 
  3597.  
  3598. Top                      The horizontal alignment of the printed labels 
  3599.  
  3600. Left                     The vertical alignment of the printed labels 
  3601.  
  3602. You will probably need to experiment with these settings to print the labels 
  3603. just how you want them. While you are experimenting, you can save time and 
  3604. labels by specifying the number of labels that will fit on one sheet as the 
  3605. sample size when you select Print. 
  3606.  
  3607.  
  3608. ΓòÉΓòÉΓòÉ 13.6.2. Addressing envelopes directly ΓòÉΓòÉΓòÉ
  3609.  
  3610. If your printer has a feed for envelopes, you can print addresses directly onto 
  3611. the envelopes: 
  3612.  
  3613. o In the Detail Area Settings window, type 1 in both the User-defined entry 
  3614.   fields. 
  3615.  
  3616. o In the Page Settings window, select the envelope size you want to use from 
  3617.   the Paper list. 
  3618.  
  3619. o In Margins entry fields, type values appropriate to your envelopes for the 
  3620.   top and left margins. 
  3621.  
  3622.  
  3623. ΓòÉΓòÉΓòÉ 13.7. Creating a financial report ΓòÉΓòÉΓòÉ
  3624.  
  3625. When you create a report to show financial information, you may find you have 
  3626. particular data and formatting requirements. For example, you might want to use 
  3627. data from a spreadsheet to create your report, and change the way numbers are 
  3628. displayed so that they are shown with a currency symbol and two decimal places. 
  3629. You may find it easier to analyze your finances if as many columns as possible 
  3630. are made to fit onto a standard sheet of paper. 
  3631.  
  3632. This section explains how to create a typical spreadsheet style report that 
  3633. analyzes totals in two directions, and uses some common formatting conventions 
  3634. for financial reports. The report produced is a cross-tabular report that also 
  3635. shows details. 
  3636.  
  3637. To create a report from spreadsheet data: 
  3638.  
  3639.  1. Create a new report and rename it. 
  3640.  
  3641.  2. Open the new report. 
  3642.  
  3643.  3. Select a data source for your report. Most spreadsheet software can export 
  3644.     data in DBF format. Select the DBF file by dragging and dropping it onto an 
  3645.     open report, or by using the Select a Table or Query window (for more 
  3646.     information, see Finding data sources for your report). If your spreadsheet 
  3647.     software cannot produce a DBF file, export the data as a DIF or TXT file. 
  3648.  
  3649.     The Select Columns and Define Groups window is displayed. 
  3650.  
  3651.  4. Select the columns you want shown in your report. 
  3652.  
  3653.  5. Select any columns you want to control grouping down the report. Do not 
  3654.     select a column to control grouping across. 
  3655.  
  3656.  6. Select any total types you want. These will be displayed along the bottom 
  3657.     of your report. 
  3658.  
  3659.  7. Select OK to close the Select Columns and Define Groups window. 
  3660.  
  3661.  8. Add a calculated column to create the totals down the side of your report, 
  3662.     instead of grouping across. 
  3663.  
  3664.     To speed up the following steps, deselect Autorefresh report on the View 
  3665.     menu. 
  3666.  
  3667.     a) Select from the tool bar. 
  3668.  
  3669.     b) In the Calculate Columns window, type a name for the totals column in 
  3670.        Result name. 
  3671.  
  3672.     c) Type an expression to calculate the totals you want in the Expression 
  3673.        field. For example, to create a total that adds up the amounts in all 
  3674.        columns for each row, type the expression: 
  3675.  
  3676.        Column1+Column2+Column3 
  3677.  
  3678.        where ColumnN is the name of each column. 
  3679.  
  3680.        The totals do not have to be simple additions. They can be the result of 
  3681.        any calculation for which you can create an expression. 
  3682.  
  3683.     d) Select OK to close the Calculate Columns window. 
  3684.  
  3685.     e) Select any total types you want for the calculated column. These will be 
  3686.        shown beneath the calculated column, as grand totals, in the report. 
  3687.  
  3688.     If you deselected Autorefresh report, select it from the View menu to see 
  3689.     your completed report. 
  3690.  
  3691.  
  3692. ΓòÉΓòÉΓòÉ 13.7.1. Changing the way numbers are displayed ΓòÉΓòÉΓòÉ
  3693.  
  3694. When the figures in your report represent sums of money, you can show this by 
  3695. adding a currency symbol and by displaying the amounts in a standard format. 
  3696.  
  3697. To display amounts in your report to two decimal places, with a currency symbol 
  3698. and a thousands separator: 
  3699.  
  3700.  1. Double-click on the column you want to change. (You can also use the 
  3701.     Numeric display format push button on the Column Totals Settings window). 
  3702.  
  3703.  2. In the Column Settings window, select the Format push button. 
  3704.  
  3705.  3. In the Format window, select Numeric in the Type list. 
  3706.  
  3707.  4. In Numeric format, select Currency symbol and 1000`s separator. 
  3708.  
  3709.  5. Select 2 in the Decimal places list. 
  3710.  
  3711.  6. Select OK. 
  3712.  
  3713.  
  3714. ΓòÉΓòÉΓòÉ 13.7.2. Separating totals ΓòÉΓòÉΓòÉ
  3715.  
  3716. Often a total in a financial report is separated from other parts of the report 
  3717. by lines ruled above or below the amount. To separate a total in this way: 
  3718.  
  3719.  1. Select from the tool bar. 
  3720.  
  3721.  2. Select the Settings push button for Groups down. 
  3722.  
  3723.  3. Select the Settings push button for Group total area. 
  3724.  
  3725.  4. In the Group Total Area Settings window, select the group for which you 
  3726.     want to highlight the total. 
  3727.  
  3728.  5. Select the Separator before and Separator after check boxes. 
  3729.  
  3730.  6. Select the line style you want above the total in Separator before. 
  3731.  
  3732.  7. Select the line style you want below the total in Separator after. 
  3733.  
  3734.  8. Select OK. 
  3735.  
  3736.  9. Select OK to close the Report Settings window. 
  3737.  
  3738.  
  3739. ΓòÉΓòÉΓòÉ 13.7.3. Printing a wide report on standard paper ΓòÉΓòÉΓòÉ
  3740.  
  3741. Financial reports, such as those produced from spreadsheets, typically contain 
  3742. more columns than fit across a standard page. By printing in landscape format, 
  3743. in a small font, you can maximize the amount of your report that can be printed 
  3744. on a single page. 
  3745.  
  3746. To select landscape orientation: 
  3747.  
  3748.  1. Select from the tool bar. The Page Settings window is displayed. 
  3749.  
  3750.  2. Select the paper size you want to use from the Paper list. 
  3751.  
  3752.  3. Select Landscape in Orientation. 
  3753.  
  3754.  4. Select OK. 
  3755.  
  3756. The report is redrawn to show how it will look when printed. If you want to 
  3757. squeeze more columns onto the page, select from the tool bar to reduce the size 
  3758. of the font. Each time you press this push button, the font size is reduced by 
  3759. approximately 20%. 
  3760.  
  3761. When you are ready to print your report: 
  3762.  
  3763.  1. Select Print from the Report menu. 
  3764.  
  3765.  2. In the Print Settings window, in Pagination, select Use current pagination. 
  3766.     This ensures that any margin restrictions imposed by your printer hardware 
  3767.     do not cause the report to be repaginated. 
  3768.  
  3769.  3. Select OK. 
  3770.  
  3771. Continue printing your report as described in Describing a group. 
  3772.  
  3773.  
  3774. ΓòÉΓòÉΓòÉ 13.8. Customizing a report ΓòÉΓòÉΓòÉ
  3775.  
  3776. To change any report from the usual tabular layout to a layout of your own 
  3777. design: 
  3778.  
  3779.  1. Select Customize from the View menu. 
  3780.  
  3781.  2. Drag the blocks representing columns and column headings to their new 
  3782.     positions. 
  3783.  
  3784.  3. Select OK. 
  3785.  
  3786.  
  3787. ΓòÉΓòÉΓòÉ 14. Defining and working with Visualizer tables ΓòÉΓòÉΓòÉ
  3788.  
  3789. Use the Visualizer Table object to organize, access, and maintain data other 
  3790. than SQL data. You can use Visualizer tables to create and manipulate data if 
  3791. you are not connected to a database or have QUERY FOR OS/2 installed on a 
  3792. portable machine. You can also use Visualizer Table if you want to import data 
  3793. of a different format from another system or export (convert data to a 
  3794. different format) to another system. 
  3795.  
  3796. To organize, access, and maintain SQL data, use the SQL Table and View objects. 
  3797.  
  3798. You can drag and drop a Visualizer table onto the following objects: 
  3799.  
  3800. o SQL Database (to create an SQL table) 
  3801. o Visualizer query 
  3802. o Visualizer report 
  3803. o Folder 
  3804. o Printer 
  3805. o Shredder 
  3806.  
  3807.  
  3808. ΓòÉΓòÉΓòÉ 14.1. Defining a table ΓòÉΓòÉΓòÉ
  3809.  
  3810. A table consists of columns and rows. A column contains data of a particular 
  3811. category, for example, the names, or salaries of employees. A row contains 
  3812. related information, for example, the name and salary of an individual 
  3813. employee. 
  3814.  
  3815. A fundamental element of a Visualizer table is the key column. Key columns are 
  3816. used to identify and order each row in your table. A key column when combined 
  3817. with other key columns, provides a unique identifier or key value for each row 
  3818. in a table. Each row must have a unique key value. Each Visualizer table must 
  3819. have at least one key column defined. For information about how to define key 
  3820. columns and how they are used, see Defining column settings and Ordering rows 
  3821.  
  3822. You can define your table to suit the type of data you want it to contain by: 
  3823.  
  3824. o Adding columns 
  3825. o Renaming columns 
  3826. o Adjusting column widths 
  3827. o Adding rows 
  3828. o Inserting data 
  3829.  
  3830. To open a new table, drag the Table template from the Shadows of Templates 
  3831. folder to the desktop. 
  3832.  
  3833.  
  3834. ΓòÉΓòÉΓòÉ 14.1.1. Adding new columns ΓòÉΓòÉΓòÉ
  3835.  
  3836. To add more columns to your table: 
  3837.  
  3838.  1. Select the column handle for the empty column, which has the default name 
  3839.     of Column. The column is highlighted to show that it is selected. 
  3840.  
  3841.  2. Select from the tool bar. 
  3842.  
  3843.     A new column, Column1, is added to your table. It is placed to the right of 
  3844.     the selected column. 
  3845.  
  3846.  3. Select from the tool bar or press Ctrl+A to add a column. 
  3847.  
  3848.     A new column, Column2, is added to your table. It is placed to the right of 
  3849.     the original column. 
  3850.  
  3851.  
  3852. ΓòÉΓòÉΓòÉ 14.1.2. Renaming the columns ΓòÉΓòÉΓòÉ
  3853.  
  3854. A column name can be up to 20 characters long. It can contain uppercase and 
  3855. lowercase alphabetic characters, the numbers 0 through 9, and the underscore 
  3856. character. It must start with an alphabetic character. It cannot contain 
  3857. spaces. Examples of valid column names are: 
  3858.  
  3859. Division_1 
  3860. ClientName 
  3861. DeptCode 
  3862.  
  3863. To rename columns: 
  3864.  
  3865.  1. Select the column title. 
  3866.  2. Type the new column title over the existing column title. 
  3867.  3. Press the Tab key to select the column to the right of the currently 
  3868.     selected column. 
  3869.  4. Type the new column title over the existing column title. 
  3870.  
  3871.  
  3872. ΓòÉΓòÉΓòÉ 14.1.3. Adjusting column widths ΓòÉΓòÉΓòÉ
  3873.  
  3874. You can change the width of a column by moving its column separators. To change 
  3875. the width of the column to the left of a separator by selecting the separator 
  3876. with mouse button 1 and dragging it using the mouse. Similarly, you can change 
  3877. the width of the column to the right of the separator by selecting the 
  3878. separator with Ctrl and mouse button 1. 
  3879.  
  3880. For more information about creating the same table structure regularly by 
  3881. copying from a customized template, see Common OS/2 tasks. 
  3882.  
  3883.  
  3884. ΓòÉΓòÉΓòÉ 14.1.4. Adding new rows ΓòÉΓòÉΓòÉ
  3885.  
  3886. To add new rows to your table: 
  3887.  
  3888.  1. Select the first blank field in the leftmost column and type your data. 
  3889.  
  3890.  2. Tab to the next field and type your data. 
  3891.  
  3892.     Repeat this procedure until you have inserted your data into the first 
  3893.     blank field of the columns that require data. This constitutes a row of 
  3894.     related information. 
  3895.  
  3896.  3. Press Ctrl+Enter to add a new row to your table. 
  3897.  
  3898.     You can insert a new row in any position in your table by placing the 
  3899.     cursor in the row above the position at which you want to insert the new 
  3900.     row, and pressing Ctrl+Enter. 
  3901.  
  3902.  4. Select Save from the Table menu to save your newly defined table and any 
  3903.     data you have entered. 
  3904.  
  3905.  5. To close your table, double-click on the title-bar icon. 
  3906.  
  3907.  
  3908. ΓòÉΓòÉΓòÉ 14.2. Inserting data into your table ΓòÉΓòÉΓòÉ
  3909.  
  3910. When a table is opened it is in browse mode by default. To make any changes to 
  3911. data in the table you must switch to update mode. To switch browse mode to 
  3912. update mode, select from the tool bar. 
  3913.  
  3914. There are several different ways of inserting data in your table: 
  3915.  
  3916. To view and change data quickly: 
  3917.                     Select from the tool bar, to update several rows of your 
  3918.                     table at the same time. Press the Tab key to move from cell 
  3919.                     to cell. 
  3920.  
  3921. To enter a lot of data quickly, one row at a time: 
  3922.                     Select Open power insert from the Table menu. The Power 
  3923.                     Insert window enables you to see many column fields at the 
  3924.                     same time and to move quickly among them. This is 
  3925.                     especially helpful if your table has a large number of 
  3926.                     columns. More detailed information is available in the 
  3927.                     online help text. 
  3928.  
  3929. To view one row of data in detail: 
  3930.                     Select from the tool bar. If you supplied Valid ranges for 
  3931.                     any of your columns, the form view shows you which values 
  3932.                     can be accepted in those columns. In addition, the form 
  3933.                     view indicates the key columns in your table by underlining 
  3934.                     their column names. For more information, see Checking the 
  3935.                     data in your table and Displaying your table. 
  3936.  
  3937. To change data in a table: 
  3938.  
  3939.  1. Select to place the data in the table in update mode. 
  3940.  2. Select the cell you want to change. 
  3941.  3. Type a new value over the existing value. 
  3942.  
  3943. To delete a row from a table: 
  3944.  
  3945.  1. Select the handle for the row you want to delete. 
  3946.  
  3947.     The whole row is highlighted to show that it is selected. This is different 
  3948.     from step 2 in which you selected a single cell. 
  3949.  
  3950.  2. Select Delete from the Edit menu. The row is deleted from the table. 
  3951.  
  3952.  3. To save the changes you have made to the table, select Save from the Table 
  3953.     menu. 
  3954.  
  3955.  
  3956. ΓòÉΓòÉΓòÉ 14.3. Displaying your table ΓòÉΓòÉΓòÉ
  3957.  
  3958. You can display the data in your table in different ways by: 
  3959.  
  3960. o Displaying your data as a form 
  3961. o Anchoring columns in your table 
  3962. o Selecting specific columns to display 
  3963. o Displaying valid column values 
  3964.  
  3965. You can select specific columns of data for display. You can also anchor 
  3966. columns in your table so that they will always be visible, and not scrolled out 
  3967. of sight. Alternatively, you can view your table one row at a time, to show the 
  3968. valid values for each column. 
  3969.  
  3970.  
  3971. ΓòÉΓòÉΓòÉ 14.3.1. Displaying the table as a form ΓòÉΓòÉΓòÉ
  3972.  
  3973. To display your table as a form, select from the tool bar. 
  3974.  
  3975. Your table is displayed one row at a time, as a form. Each column value for the 
  3976. row is arranged on your screen as a field in the form. If your table has many 
  3977. columns, the form will have several pages. You can page through the form by 
  3978. using the scroll bar. Scroll through the rows in your table by using the 
  3979. Previous and Next push buttons. 
  3980.  
  3981. The way each row of data is displayed in a form view, depends on the type of 
  3982. data each column contains. For information about how column values are 
  3983. displayed, see Displaying column values 
  3984.  
  3985. More detailed information about using the form view is available in the online 
  3986. help text. 
  3987.  
  3988. To return to the table view, select from the tool bar. 
  3989.  
  3990.  
  3991. ΓòÉΓòÉΓòÉ 14.3.2. Anchoring columns in your table ΓòÉΓòÉΓòÉ
  3992.  
  3993. To anchor specific columns in your table so they remain visible within the 
  3994. window and not scrolled out of sight: 
  3995.  
  3996.  1. Select from the tool bar. 
  3997.  
  3998.  2. From the list of columns, select the columns you want to anchor in your 
  3999.     table. 
  4000.  
  4001.  3. Select OK. 
  4002.  
  4003. The columns you specify are anchored on the left of your table. They are not 
  4004. scrolled out of sight when you scroll across the table. 
  4005.  
  4006.  
  4007. ΓòÉΓòÉΓòÉ 14.3.3. Displaying a subset of columns ΓòÉΓòÉΓòÉ
  4008.  
  4009. To display specific columns from your table: 
  4010.  
  4011.  1. Open the table. 
  4012.  
  4013.  2. To specify the columns you want to display select the Subset columns push 
  4014.     button in the information area at the bottom of the table. 
  4015.  
  4016.     If the information area is not displayed, select Subset columns from the 
  4017.     View menu. 
  4018.  
  4019.  3. From the list of columns, select the columns you want to display. 
  4020.  
  4021.     The columns are displayed in the order in which you select them. The 
  4022.     display order is shown as a number against the column name as you select 
  4023.     each column. 
  4024.  
  4025.  4. Select OK. 
  4026.  
  4027.     Only the columns you select are displayed in your table. The remaining 
  4028.     columns are still in your table though they are not shown. To display the 
  4029.     columns in the original order, select Deselect all in the Subset Columns 
  4030.     window, and then select OK. 
  4031.  
  4032.  
  4033. ΓòÉΓòÉΓòÉ 14.3.4. Displaying column values ΓòÉΓòÉΓòÉ
  4034.  
  4035. Column values in your table can be displayed in several different ways: 
  4036.  
  4037. Check boxes 
  4038.  
  4039. o Valid values of 0 or 1 only 
  4040. o Reject or Replace with default selected for Null values in the Default view 
  4041.   of the Column Settings window 
  4042. o Enforce data validation selected in the Column Settings window 
  4043.  
  4044. You can enter or change data in the column by selecting or deselecting its 
  4045. check box. When you select the check box, the value 1 is displayed in the 
  4046. column. When you deselect the check box, 0 is displayed in the column. 
  4047.  
  4048. You can choose not to have check boxes, by deselecting Use check boxes in the 
  4049. Table Settings window. 
  4050.  
  4051. Radio buttons 
  4052.  
  4053. o Four or fewer valid values. For example, if you specify a Valid range of 
  4054.   2;13;24, only the values 2, 13, and 24 are valid. 
  4055. o Reject or Replace with default selected for Null values in the Default view 
  4056.   of the Column Settings window. 
  4057. o Enforce data validation selected in the Column Settings window. 
  4058.  
  4059. You can enter or change data in the column by selecting a radio button. The 
  4060. value entered in the column corresponds to the value associated with radio 
  4061. button you select. 
  4062.  
  4063. Drop-down lists 
  4064.  
  4065. o More than four valid values 
  4066. o Four or fewer valid values, but in which null values are allowed 
  4067. o Four or fewer valid values, but in which Enforce data validation is not 
  4068.   selected 
  4069.  
  4070. Single-line entry areas 
  4071.  
  4072. o No Valid range specified. 
  4073. o An unknown number of valid values. For example, if you enter a Valid range of 
  4074.   2:4, any value between 2 and 4 is valid (such as 2.3 or 3.1). 
  4075.  
  4076. To turn on the checks and defaults for a column, select Enforce data validation 
  4077. in the Column Settings window. 
  4078.  
  4079. An information area is displayed at the bottom of your form. This tells you the 
  4080. number of: 
  4081.  
  4082. o Columns in your table. 
  4083. o Columns currently available for display. 
  4084. o Rows in your table. 
  4085. o Row currently being displayed 
  4086. You can select the push buttons in the information area to display the Subset 
  4087. Columns and Subset Rows windows. 
  4088.  
  4089. You can choose not to display the information area by deselecting Information 
  4090. area from the View menu. 
  4091.  
  4092.  
  4093. ΓòÉΓòÉΓòÉ 14.4. Changing the structure of your table ΓòÉΓòÉΓòÉ
  4094.  
  4095. You can change the structure of your table by joining and splitting columns. 
  4096. You can also change the table by deleting rows and removing empty space. 
  4097.  
  4098. The following section assumes you are starting from a Visualizer Table window 
  4099. displaying the current table. It also assumes that there are no column and row 
  4100. subsets selected. 
  4101.  
  4102.  
  4103. ΓòÉΓòÉΓòÉ 14.4.1. Joining columns ΓòÉΓòÉΓòÉ
  4104.  
  4105. To join two columns and rename the new column: 
  4106.  
  4107.  1. Hold down the Ctrl key, and select the column handles for the two columns 
  4108.     you want to join. 
  4109.  
  4110.  2. Select from the tool bar. 
  4111.  
  4112.     The name of the first column is displayed in the 1st column field, and the 
  4113.     name of the second column in the 2nd column field. 
  4114.  
  4115.  3. Type a hyphen in the Separator field. 
  4116.  
  4117.  4. Select Join. 
  4118.  
  4119.     The two columns are joined. The values from the columns are separated by a 
  4120.     hyphen in the new column. The name of the new column is the same as that in 
  4121.     the 1st column field. 
  4122.  
  4123.     You cannot join key columns. You can change the key column value in the 
  4124.     Column Settings window. 
  4125.  
  4126.  5. Rename the column by typing a new name over the displayed name. 
  4127.  
  4128.  
  4129. ΓòÉΓòÉΓòÉ 14.4.2. Splitting a column ΓòÉΓòÉΓòÉ
  4130.  
  4131. To split one column into two: 
  4132.  
  4133.  1. Select the column to be split. 
  4134.  
  4135.  2. Select from the tool bar. 
  4136.  
  4137.  3. If the column contains a separator character select the Separator button 
  4138.     and type the character. 
  4139.  
  4140.  4. Select Split. 
  4141.  
  4142.     The column is split into two columns at the separator. 
  4143.  
  4144.     If your data does not have a separator character, you can specify a 
  4145.     character position at which the column is to be split. If you split a key 
  4146.     column, both columns remain as key columns. If your table already has the 
  4147.     maximum 16 key columns, the existing key column 16 ceases to be a key 
  4148.     column. More detailed information is available in the online help text. 
  4149.  
  4150.  5. Rename the columns by typing new names over the displayed names. 
  4151.  
  4152.  
  4153. ΓòÉΓòÉΓòÉ 14.4.3. Deleting parts of your table ΓòÉΓòÉΓòÉ
  4154.  
  4155. You can delete columns, rows, and cells from your table using the handles in 
  4156. the table and selecting Delete from the Edit menu. The following description 
  4157. shows how to delete a row. 
  4158.  
  4159.  1. Scroll down your table to the row you want to delete, or select Find from 
  4160.     the Edit menu to search for a value. More detailed information is available 
  4161.     in the online help text. 
  4162.  
  4163.  2. Select the handle for the row to be deleted. 
  4164.  
  4165.  3. Select Delete from the Edit menu. 
  4166. The row is deleted from your table. 
  4167.  
  4168. If you accidentally delete a row, you can restore it by selecting Undo delete 
  4169. from the Edit menu. Undo delete restores only the last deletion. 
  4170.  
  4171.  
  4172. ΓòÉΓòÉΓòÉ 14.4.4. Removing empty space in your table ΓòÉΓòÉΓòÉ
  4173.  
  4174. When you delete a large amount of data from a table, its overall size does not 
  4175. change, because the extra space remains allocated. To free that extra space, 
  4176. select Save compressed from the Table menu. This saves the table and frees the 
  4177. extra space. 
  4178.  
  4179.  
  4180. ΓòÉΓòÉΓòÉ 14.5. Checking the data in your table ΓòÉΓòÉΓòÉ
  4181.  
  4182. You can define the type of data or the values that a column can contain using 
  4183. column settings. Use column settings to define: 
  4184.  
  4185. o The type of numeric data 
  4186. o The range of the data (must be a positive value) 
  4187. o Single values (for example, P for personal friend or B for a business 
  4188.   associate) 
  4189.  
  4190. This section shows you how to complete the following tasks: 
  4191.  
  4192. o Adding another column to an existing table. 
  4193. o Defining column settings. 
  4194. o Validating data by checking the value entered in the column. 
  4195. o Specifying a default value for a column if no value is entered. 
  4196. o Changing the order of the rows. 
  4197. o Assigning key columns. 
  4198.  
  4199.  
  4200. ΓòÉΓòÉΓòÉ 14.5.1. Adding another column ΓòÉΓòÉΓòÉ
  4201.  
  4202. To add a column to an existing table: 
  4203.  
  4204.  1. Select a column. 
  4205.  
  4206.  2. Select from the tool bar. This adds a new column to the right of the 
  4207.     selected column, and copies the settings of the selected column to the new 
  4208.     column. 
  4209.  
  4210.  3. Rename the new column by typing over the default heading. 
  4211.  
  4212.  
  4213. ΓòÉΓòÉΓòÉ 14.5.2. Defining column settings ΓòÉΓòÉΓòÉ
  4214.  
  4215. You can specify settings for each column in the Column Settings window. In this 
  4216. window, you can select: 
  4217.  
  4218. General   To specify the common properties for the column. For example, you can 
  4219.           select the type of data a column can contain: Character, Numeric, 
  4220.           Date, or Time. Detailed information is available in the online help 
  4221.           text. 
  4222.  
  4223. Default   To enter default values for the column. You can enter a default value 
  4224.           and specify how to treat blank (or null) values. 
  4225.  
  4226. Checks    To specify checks on data in the column. For example, you can choose 
  4227.           to accept data only within a specified range. 
  4228.  
  4229. Format    To specify how the data in numeric columns is displayed in your 
  4230.           table. For example, you can select the number of decimal places that 
  4231.           are displayed. 
  4232.  
  4233. Fields in the Format view of the Column Settings window can be selected only if 
  4234. the column contains numeric data. Therefore, when you are using the Format view 
  4235. of the Column Settings window, you can always tell whether the column holds 
  4236. numeric data, because the fields are grayed if the data is not numeric. 
  4237.  
  4238. To change some of the column settings for a column: 
  4239.  
  4240.  1. Double-click on a column handle. The general settings for the column are 
  4241.     displayed in the Column Settings window. 
  4242.  
  4243.     If the column was created as described in the previous section, the 
  4244.     settings have been copied from the column on which you based the new 
  4245.     column. The key column value was not copied. 
  4246.  
  4247.  2. In the Data type field, specify the kind of data the column can contain. 
  4248.  
  4249.  3. If the column is not a key column, type 0 in the Key field. If the column 
  4250.     is a key column, type its position in the Key field. 
  4251.  
  4252.  4. Select Descending to display the key columns in reverse order. 
  4253.  
  4254.  5. Type the number of characters to be displayed in the Display width field. 
  4255.  
  4256.     The width (in characters) defined in Display width is the number of 
  4257.     characters of the column that can be viewed. The display width only limits 
  4258.     what you can view. It does not affect the amount of data in the column. 
  4259.  
  4260.  6. Specify where the column will appear in the table in the Position field. 
  4261.     For example, specifying 2 means the column will appear as the second column 
  4262.     from the left in the table. 
  4263.  
  4264.  7. Type a description of the column in the Comment field. 
  4265.  
  4266. To see the comment about a column, press F1 with the cursor in the column value 
  4267. entry field. 
  4268.  
  4269. If you want several of your columns to have the same settings, specify the 
  4270. settings for the first column and then copy it. The settings, except the Key 
  4271. value, are also copied. This is quicker than copying a column and then choosing 
  4272. the settings for each column individually. 
  4273.  
  4274.  
  4275. ΓòÉΓòÉΓòÉ 14.5.3. Validating data ΓòÉΓòÉΓòÉ
  4276.  
  4277. To enter a valid range for the column, so that only certain values can be 
  4278. accepted in the column: 
  4279.  
  4280.  1. Select Checks to display the Checks settings in the Column Settings window. 
  4281.  
  4282.  2. Type the allowable values in the Valid ranges field. 
  4283.  
  4284.     Entering values other than those specified causes an error message to be 
  4285.     displayed. 
  4286.  
  4287.     Choosing a valid range is just one type of check you can do in your table. 
  4288.     You can validate the data entered in a column in the following ways: 
  4289.  
  4290.    o Choose the type of data a column can contain. 
  4291.  
  4292.    o Choose whether to accept blank (or null) values in the column. You can 
  4293.      replace any null values with your chosen default value. 
  4294.  
  4295.    o Define a check expression, to ensure that the data meets conditions you 
  4296.      have chosen. 
  4297.  
  4298.    o Specify a valid range for values in the column, to ensure that data is 
  4299.      within the range you have chosen. 
  4300.  
  4301.     For example, to restrict the valid range for a column of salary data to the 
  4302.     range of $14,000 to $24,000, type: 14000:24000. 
  4303.  
  4304.     Detailed information about entering check expressions and valid ranges is 
  4305.     available in the online help text. 
  4306.  
  4307.  
  4308. ΓòÉΓòÉΓòÉ 14.5.4. Setting defaults ΓòÉΓòÉΓòÉ
  4309.  
  4310. To specify a default value for a column, so the value is automatically entered 
  4311. if you do not supply a value: 
  4312.  
  4313.  1. Select Default to display the Default settings in the Column Settings 
  4314.     window. 
  4315.  
  4316.  2. Type a value in the Default value field. This value will be used if no 
  4317.     value is entered. 
  4318.  
  4319.  3. Select Replace with default. 
  4320.  
  4321.  4. Check that Enforce data validation is selected for the Type column. 
  4322.  
  4323.     To activate the checks and defaults for a column, select the Enforce data 
  4324.     validation check box in the Column Settings window. Enforce data validation 
  4325.     is automatically selected if you make column into a key column. 
  4326.  
  4327.  5. Select OK. 
  4328.  
  4329.  
  4330. ΓòÉΓòÉΓòÉ 14.5.5. Ordering rows ΓòÉΓòÉΓòÉ
  4331.  
  4332. To order rows in a table: 
  4333.  
  4334.  1. In the Column Settings window, select 1 as the key number for the column. 
  4335.     You must have specified a key column 1 before you can specify a key column 
  4336.     2, and so on. 
  4337.  
  4338.     You can check which are the key columns in your table by looking in the 
  4339.     Table Settings window. 
  4340.  
  4341.  2. Select OK. 
  4342.  
  4343.     The rows are reordered when you specify a new key column 1. Rows are 
  4344.     ordered first by the data type in key column 1, for example, first name 
  4345.     then second name. 
  4346.  
  4347.  
  4348. ΓòÉΓòÉΓòÉ 14.6. Selecting rows using selection expressions ΓòÉΓòÉΓòÉ
  4349.  
  4350. If you have a large amount of data in a table and want to see only those rows 
  4351. that hold the information you are interested in, you can create a new table 
  4352. containing this information. 
  4353.  
  4354. You can obtain and display this information by using selection expressions. 
  4355. There are two ways of selecting rows of data using selection expressions, 
  4356. either by typing an expression directly, or by building one. 
  4357.  
  4358.  
  4359. ΓòÉΓòÉΓòÉ 14.6.1. Typing an expression directly ΓòÉΓòÉΓòÉ
  4360.  
  4361. You can select rows of data by typing a selection expression directly if you 
  4362. know the correct syntax. 
  4363.  
  4364. To display a subset of rows in a table: 
  4365.  
  4366.  1. Select Subset rows from the information area at the bottom of the table. 
  4367.     The Subset Rows window is displayed. 
  4368.  
  4369.  2. Type the selection expression directly into the entry field. 
  4370.  
  4371.  3. Select OK. 
  4372.  
  4373. The table now displays only the rows selected by the expression. The 
  4374. information area displays how many rows of the table are currently selected. 
  4375.  
  4376.  
  4377. ΓòÉΓòÉΓòÉ 14.6.2. Building an expression ΓòÉΓòÉΓòÉ
  4378.  
  4379. To ensure the syntax of a selection expression is correct, build the expression 
  4380. using the Expression Builder. An expression is built using the Expression 
  4381. Builder by selecting choices from the lists and by typing values into the 
  4382. Expression (in ASL syntax) field. 
  4383.  
  4384. The following steps show how to build the expression 
  4385.  
  4386.  1. Select in the Subset Rows window. The Expression Builder window is 
  4387.     displayed. 
  4388.  
  4389.  2. Select Division from the Operands and operators list. 
  4390.  
  4391.     Division is displayed in the Expression (in ASL syntax) field. 
  4392.  
  4393.  3. Select Comparison operators from Operands and operator types. 
  4394.  
  4395.  4. Select = Equal to from the Operands and operators list. 
  4396.  
  4397.  5. In the Expression (in ASL syntax) field, type "Head Office". after the = 
  4398.     sign. 
  4399.  
  4400.  6. Select Logic symbols from Operands and operator types. 
  4401.  
  4402.  7. Select | Or from the Operands and operators list. 
  4403.  
  4404.  8. Select Column names from Operands and operator types. 
  4405.  
  4406.  9. Repeat steps 2 through 5 to add the Research division. Alternatively, you 
  4407.     can type the rest of the expression directly into the Expression (in ASL 
  4408.     syntax) field. 
  4409.  
  4410. 10. Select OK in the Expression Builder window. 
  4411.  
  4412. 11. Select OK in the Subset Rows window. 
  4413.  
  4414. To create a table that holds only the information selected by the expression, 
  4415. select Copy to from the Table menu. 
  4416.  
  4417.  
  4418. ΓòÉΓòÉΓòÉ 14.7. Printing a table ΓòÉΓòÉΓòÉ
  4419.  
  4420. To print your table, drag it and drop it on a printer object. You can drag 
  4421. either the icon of a closed table, or the title-bar mini-icon of an open table. 
  4422.  
  4423. Alternatively you can: 
  4424.  
  4425.  1. Select Print from the Table menu. 
  4426.  
  4427.     If you have deselected Review printing options in the QUERY FOR OS/2 
  4428.     Profile notebook, your table is now printed using the OS/2 default printer. 
  4429.     If Review printing options is selected (this is the default setting), the 
  4430.     Printer Selection window is displayed. 
  4431.  
  4432.  2. Select the printer you want to use. 
  4433.  
  4434.  3. Select Print and the Print window is displayed. If you are displaying a 
  4435.     subset of your table you can choose whether to print the subset or the 
  4436.     whole table. You can also define the width (in characters) and the depth 
  4437.     (in lines) of the printed page. 
  4438.  
  4439.  4. Select Print and the Print Copies window is displayed. 
  4440.  
  4441.  5. Type the number of copies you want to print. 
  4442.  
  4443.  6. Select Print and the Font Selection window is displayed. 
  4444.  
  4445.  7. Select a font. 
  4446.  
  4447.  8. Select Print. 
  4448.  
  4449. Your table is then sent to the selected printer. 
  4450.  
  4451.  
  4452. ΓòÉΓòÉΓòÉ 14.8. Importing and exporting tables ΓòÉΓòÉΓòÉ
  4453.  
  4454. You can bring in a table from another system and keep a copy of the table. This 
  4455. is called importing a table. 
  4456.  
  4457. You can also send a Visualizer table to another system or convert it to another 
  4458. format for use in other software products. This is called exporting a table. 
  4459.  
  4460. You can import and export data from many different sources, including: 
  4461.  
  4462. o Queries 
  4463.  
  4464. o SQL databases 
  4465.  
  4466. o Visualizer tables 
  4467.  
  4468. o AS/400* files (including SQL/400* tables and views) 
  4469.  
  4470. o Flat (ASCII), List (ASCII CSV), IXF, PCIXF, DBF, DIF Standard, and 
  4471.   DIFExtended files 
  4472.  
  4473. Detailed information about the sources you can access is available in the 
  4474. online help text for the Import and Export windows. 
  4475.  
  4476. When you export an SQL table to a Visualizer table, the data is stored 
  4477. differently. Installing and Supporting Visualizer Query for OS/2 describes the 
  4478. differences. 
  4479.  
  4480.  
  4481. ΓòÉΓòÉΓòÉ 14.8.1. Importing a table ΓòÉΓòÉΓòÉ
  4482.  
  4483. To import a table, starting from a Table window displaying the current table: 
  4484.  
  4485.  1. Select Import from the Table menu. 
  4486.  
  4487.     A message appears, warning you that the structure and contents of the 
  4488.     current table will be overwritten. 
  4489.  
  4490.  2. Select OK. The Import window is displayed: 
  4491.  
  4492.  3. Select the type of table you want to import, from the list of Types. 
  4493.  
  4494.  4. Select the location of the table from the list in the Locations field. When 
  4495.     you select a location from the list in the Locations field, the names of 
  4496.     the tables that exist for that location will be listed in the Names field. 
  4497.  
  4498.  5. Select the name of the table from the list in the Names field. 
  4499.  
  4500.     To import a subset of the selected table: 
  4501.  
  4502.     a) Select the Subset push button. The Subset window is displayed. 
  4503.  
  4504.     b) To select the rows you require type a selection expression in the 
  4505.        Selection Expression field. 
  4506.  
  4507.     c) From the list of columns in the Select columns field, select the columns 
  4508.        you require. 
  4509.  
  4510.     d) Select OK in the Subset window. 
  4511.  
  4512.  6. Select OK in the Import window. 
  4513.  
  4514.     The table or subset you chose is imported into the current table. 
  4515.  
  4516.  
  4517. ΓòÉΓòÉΓòÉ 14.8.2. Exporting a table ΓòÉΓòÉΓòÉ
  4518.  
  4519. Exporting a table is done in a similar manner to that of importing a table. To 
  4520. export a table, starting from a Table window displaying the current table: 
  4521.  
  4522.  1. Select Export from the Table menu. 
  4523.  
  4524.  2. Next to Export as, select the type of destination table or file. 
  4525.  
  4526.  3. Select the name and, if appropriate, the location of the table or file. 
  4527.  
  4528.  4. Select Export. 
  4529.  
  4530. The structure and contents of the current table are copied to the destination 
  4531. table, or file you have chosen. Your current table is unchanged. 
  4532.  
  4533.  
  4534. ΓòÉΓòÉΓòÉ 15. Accessing SQL databases ΓòÉΓòÉΓòÉ
  4535.  
  4536. Use the SQL Database object to access databases that contain the tables and 
  4537. views you want to work with. To access a database, associate it with an SQL 
  4538. Database object, then open the object and work with your data. You can create 
  4539. several objects that access a single database, each including a different set 
  4540. of data. When you install QUERY FOR OS/2, it automatically creates an SQL 
  4541. Database for each database you had access to before installing QUERY FOR OS/2. 
  4542.  
  4543. Using the SQL Database object, you can retrieve data from local databases (on 
  4544. your workstation with DB2/2 installed) or remote databases (on another 
  4545. workstation or host system) in the following database managers: 
  4546.  
  4547. DB2/2                                             DB2/VM (SQL/DS) 
  4548. DB2/6000                                          DB2/VSE (SQL/DS) 
  4549. DB2 on MVS                                        AS/400 Database 
  4550.  
  4551. You can drag and drop an SQL Database object onto the following objects: 
  4552.  
  4553. o Folder 
  4554. o Shredder 
  4555.  
  4556. This chapter shows you how to: 
  4557.  
  4558. o Associate an SQL Database object with a database 
  4559. o Include specific tables and views in the object 
  4560. o Add more databases that you can associate with an object 
  4561. o Run SQL statements against a selected database 
  4562. o Use the results of an SQL statement 
  4563. o Access an SQL Database object from an application. 
  4564.  
  4565.  
  4566. ΓòÉΓòÉΓòÉ 15.1. Associating an SQL Database object with a database ΓòÉΓòÉΓòÉ
  4567.  
  4568. Before you can use QUERY FOR OS/2 to access SQL tables and SQL views, you must 
  4569. access the database they are stored in. To access the database, associate an 
  4570. SQL Database object with it: 
  4571.  
  4572.  1. Create a new SQL Database object and rename it. Creating a new object lets 
  4573.     you associate it with a database without changing the original template. 
  4574.     See Common OS/2 tasks for information on how to do this. 
  4575.  
  4576.  2. Open the new object's notebook. 
  4577.  
  4578.  3. On the Database page, select a database from the Database list. If the list 
  4579.     does not contain the database you want, see Updating the Database list. 
  4580.  
  4581.  4. Select Apply. The object remains associated with the database until you 
  4582.     delete the object. 
  4583.  
  4584. When you open an SQL Database object and select a table, the table is displayed 
  4585. so you can browse or update it. If you want to create new tables or views, see 
  4586. Looking at and creating SQL tables or Looking at and creating SQL views. 
  4587.  
  4588. You must be authorized to access the database. Additionally, before you can 
  4589. open an SQL Database object, QUERY FOR OS/2 must bind with the database. The 
  4590. bind process stores files in the database that QUERY FOR OS/2 uses to access 
  4591. the data. If you are already authorized, QUERY FOR OS/2 automatically binds the 
  4592. database for you. If you are not authorized, or an error occurs when you open 
  4593. an object, contact your database administrator. 
  4594.  
  4595.  
  4596. ΓòÉΓòÉΓòÉ 15.2. Including tables and views in an SQL Database object ΓòÉΓòÉΓòÉ
  4597.  
  4598. You can create several objects that access a single database, each including a 
  4599. different set of data. For example, suppose your business owns 20 stores. The 
  4600. sales, profit, and inventory data for these stores are in one database. You can 
  4601. create an object for each store that contains only sales data. Each object 
  4602. accesses the same database, but shows you only the data you need: 
  4603.  
  4604. When you first open an SQL Database object after associating it with a 
  4605. database, the object contains only the existing tables and views you currently 
  4606. own under your user ID. You can change what is included in the open views of 
  4607. the object using the Include page of the notebook: 
  4608.  
  4609.  1. Open the notebook. 
  4610.  
  4611.  2. On the Include page, type the collection name of what you want to include 
  4612.     in Collection. The collection name is the first part of a two-part 
  4613.     identifier. It can be the user ID of the owner of the tables and views or 
  4614.     some other name, depending on the database you are accessing. 
  4615.  
  4616.     You can use an asterisk (*) or a question mark (?) as a global character to 
  4617.     specify more than one table or view. A global character can represent other 
  4618.     characters in a name. For example, j*n includes tables owned by Joan, John, 
  4619.     and Jan, while j?n includes only Jan's tables. 
  4620.  
  4621.     If you leave Collection blank, it defaults to the current user ID. If you 
  4622.     created tables or views and assigned them a collection name other than your 
  4623.     current ID, they are not included. 
  4624.  
  4625.  3. Type the second part of the two-part identifier in the Name field. 
  4626.  
  4627.  4. Select SQL Table, SQL View, or both from the Type list box. 
  4628.  
  4629.  5. With Automatic refresh selected, the contents of the object are refreshed 
  4630.     when you move the cursor out of the field or close the window. The object 
  4631.     now includes the tables and views that meet the new settings. If you 
  4632.     deselect Automatic refresh and change the settings, you must explicitly 
  4633.     refresh the database object by selecting Refresh now from the object's 
  4634.     pop-up menu. 
  4635.  
  4636.  
  4637. ΓòÉΓòÉΓòÉ 15.3. Updating the Database list ΓòÉΓòÉΓòÉ
  4638.  
  4639. The Database page of the notebook contains the Database list. You can associate 
  4640. an SQL Database object with any database in the list. The list contains all the 
  4641. databases that are cataloged in DB2/2 or CAE/2. Cataloging a database adds it 
  4642. to the database directory, which is a file that contains information about the 
  4643. databases, for use by DB2/2 or CAE/2. When you install QUERY FOR OS/2, it 
  4644. automatically creates an SQL Database object for each cataloged database and 
  4645. adds it to the list. 
  4646.  
  4647. If the database you want is not listed, you can add it to the list by 
  4648. cataloging it. Another way to add a database to the list is by creating a local 
  4649. database, which catalogs it automatically. 
  4650.  
  4651.  
  4652. ΓòÉΓòÉΓòÉ 15.3.1. Cataloging a database ΓòÉΓòÉΓòÉ
  4653.  
  4654. To catalog a database: 
  4655.  
  4656.  1. Create a new SQL Database object and rename it. See Common OS/2 tasks for 
  4657.     information on how to do this. 
  4658.  
  4659.  2. Open the new object's notebook. 
  4660.  
  4661.  3. On the Database page, select New. 
  4662.  
  4663.  4. In the New Database window, select Catalog a database. 
  4664.  
  4665.  5. Type an alias for the database you want to catalog in Alias. An alias is an 
  4666.     alternative name that must be unique on your workstation. 
  4667.  
  4668.  6. Type the name of the database in Database. The name was assigned when the 
  4669.     database was created. Contact your database administrator for a list of 
  4670.     databases you can catalog. 
  4671.  
  4672.  7. Type a descriptive word or phrase in Comment to help you remember what you 
  4673.     are using the database for. This step is optional. 
  4674.  
  4675.  8. If the database is remote (on another workstation or a host system): 
  4676.  
  4677.     a) Select Remote. 
  4678.     b) From Workstation, select the name of the workstation on which the 
  4679.        database is stored. 
  4680.  
  4681.     If the database is local (on your workstation): 
  4682.  
  4683.     a) Select Local. 
  4684.     b) From Drive, select the drive on which the database is stored. 
  4685.  
  4686.  9. Select Catalog. The database is added to the Database list on the Database 
  4687.     page of the notebook. You can now access it with the current object; see 
  4688.     Associating an SQL Database object with a database. 
  4689.  
  4690. The other way to add a database to the Database list is to create a local 
  4691. database. 
  4692.  
  4693.  
  4694. ΓòÉΓòÉΓòÉ 15.3.2. Uncataloging a database ΓòÉΓòÉΓòÉ
  4695.  
  4696. On the Database page of the notebook, the Database list contains all the 
  4697. databases that are cataloged in DB2/2 or CAE/2 and that you are authorized to 
  4698. access. To remove a database from the list you must uncatalog it, which removes 
  4699. it from the database directory. Removing a database from the list does not 
  4700. delete it. 
  4701.  
  4702. To uncatalog a database: 
  4703.  
  4704.  1. Open the Visualizer folder. 
  4705.  
  4706.  2. Open the Shadows of Templates folder. 
  4707.  
  4708.  3. Open the notebook of the SQL Database template. 
  4709.  
  4710.  4. On the Database page, select a database from the Database list. 
  4711.  
  4712.  5. Select Uncatalog. 
  4713.  
  4714.  6. A confirmation window is displayed. Select Yes to uncatalog the database. 
  4715.  
  4716.  
  4717. ΓòÉΓòÉΓòÉ 15.3.3. Creating a local database ΓòÉΓòÉΓòÉ
  4718.  
  4719. You can use the SQL Database object to create a local DB2/2 database on your 
  4720. workstation. Creating a database in this way also catalogs it, which adds it to 
  4721. the DB2/2 or CAE/2 database directory. After creating a local database, you can 
  4722. associate it with the current object. 
  4723.  
  4724. To create a local database: 
  4725.  
  4726.  1. Create a new SQL Database object and rename it. See for information on how 
  4727.     to do this. 
  4728.  
  4729.  2. Open the new object's notebook. 
  4730.  
  4731.  3. On the Database page, select New. 
  4732.  
  4733.  4. In the New Database window, select Create a local database. 
  4734.  
  4735.  5. Type a name for the database in Database. The name must be unique on your 
  4736.     workstation. For information about naming conventions, see the SQL 
  4737.     reference for the database you are using. 
  4738.  
  4739.  6. Type a descriptive word or phrase in Comment to help you remember what you 
  4740.     are using the database for. This step is optional. 
  4741.  
  4742.  7. From Drive, select the drive on which the database is to be stored. 
  4743.  
  4744.  8. Select Create to create the database. 
  4745.  
  4746. When a local database is created, it is automatically cataloged in the DB2/2 or 
  4747. CAE/2 database directory and added to the Database list on the Database page of 
  4748. the notebook. You can now access it through the current object; see Associating 
  4749. an SQL Database object with a database. 
  4750.  
  4751.  
  4752. ΓòÉΓòÉΓòÉ 15.3.4. Shredding a database ΓòÉΓòÉΓòÉ
  4753.  
  4754. When you delete an SQL Database object, you delete only the object, not the 
  4755. database it accesses. There is one exception. If the object accesses a local 
  4756. database, you can delete the database as well. 
  4757.  
  4758. To delete a database: 
  4759.  
  4760.  1. Close all open views (notebook, icon view, details view, and Enter SQL 
  4761.     window) of the object. 
  4762.  
  4763.  2. Drag the object to the shredder or select Delete from the pop-up menu. 
  4764.  
  4765.  3. In the Delete Objects window, select Delete. If Confirm on folder delete is 
  4766.     selected, a prompt is displayed; select Yes. The SQL Database object is 
  4767.     deleted, although the actual database still exists. 
  4768.  
  4769.  4. If the database is local, another message is displayed. Select Yes to 
  4770.     delete the local database. 
  4771.  
  4772. You cannot delete remote databases with an SQL Database object. To delete a 
  4773. remote database, contact your database administrator or the owner of the 
  4774. database. 
  4775.  
  4776.  
  4777. ΓòÉΓòÉΓòÉ 15.4. Running SQL statements ΓòÉΓòÉΓòÉ
  4778.  
  4779. QUERY FOR OS/2 offers two ways to run SQL statements: 
  4780.  
  4781. o If you run a certain SQL statement frequently, or you want to store a 
  4782.   statement and use its result in a report, use an SQL statement object. Use an 
  4783.   SQL statement object when: 
  4784.  
  4785.    - You use the same statement frequently 
  4786.    - You want to use the result of a SELECT statement to create a report 
  4787.    - You are importing a statement from a plain text file 
  4788.    - You are importing a Prompted Query or an SQL Query from Query Manager 
  4789.  
  4790.   See Creating effective SQL statements for more information. 
  4791.  
  4792. o If you are working with the tables and views in an SQL Database object, you 
  4793.   can use the Enter SQL window to run statements in that database, as described 
  4794.   in this chapter. Use the Enter SQL window for running: 
  4795.  
  4796.    - Statements you run occasionally 
  4797.  
  4798.    - Database administration statements 
  4799.  
  4800.    - Multiple SQL statements 
  4801.  
  4802.    - Statements with active cursors, with which you can retrieve a set of rows 
  4803.      from a table. 
  4804.  
  4805.   You can run any statement except CONNECT from the Enter SQL window. 
  4806.  
  4807. To run an SQL statement: 
  4808.  
  4809.  1. Open the Enter SQL window: 
  4810.  
  4811.     a) Display the object's pop-up menu. 
  4812.     b) Select the arrow to the right of Open. 
  4813.     c) Select the Enter SQL choice. 
  4814.  
  4815.  2. Type a statement in the SQL statement field. 
  4816.  
  4817.  3. Select Submit to send the statement to the database. 
  4818.  
  4819.     With Automatic commit selected, the database runs the statement. If the 
  4820.     statement results in any changes to the database, the changes are added 
  4821.     automatically. 
  4822.  
  4823.     If you deselect Automatic commit, you must select either Commit, which adds 
  4824.     the changes to the database, or Rollback, which directs the database to 
  4825.     disregard the results of the statement. You can commit or roll back several 
  4826.     submitted statements at a time. For more information about committing and 
  4827.     rolling back statements, see the documentation for the database you are 
  4828.     using. 
  4829.  
  4830. Any statement you submitted during a session is available to you with Retrieve. 
  4831. Retrieve redisplays your statements in the SQL statement field, where you can 
  4832. edit them and submit them again. Cancel SQL interrupts the processing of 
  4833. statements running in DB2/2 and DB2/6000. 
  4834.  
  4835. During a session, you can submit multiple statements before committing or 
  4836. rolling them back. Separate the statements with a semicolon (;). The Statements 
  4837. pending indicator shows how many statements you submitted, but not committed, 
  4838. to the database. 
  4839.  
  4840.  
  4841. ΓòÉΓòÉΓòÉ 15.4.1. Editing statements ΓòÉΓòÉΓòÉ
  4842.  
  4843. You can use the OS/2 clipboard to copy and paste text in an SQL statement. For 
  4844. example, to copy an item to the OS/2 clipboard, select it and press Ctrl+Ins. 
  4845. To paste an item from the OS/2 clipboard, move the cursor to where you want the 
  4846. item to appear in the SQL statement field and press Shift+Ins. 
  4847.  
  4848. The SQL History window stores statements you submit during a session. From the 
  4849. SQL History window you can run or copy statements to the clipboard or to the 
  4850. Enter SQL window. See Using the results of an SQL statement. 
  4851.  
  4852.  
  4853. ΓòÉΓòÉΓòÉ 15.4.2. Adding comments ΓòÉΓòÉΓòÉ
  4854.  
  4855. You can add comments to an SQL statement. Comments help you and others 
  4856. understand what the statement does. Each comment must begin with two dashes 
  4857. (--). You can type comments alone or at the end of any line of an SQL 
  4858. statement, but not embedded in a statement. Comments span to the end of the 
  4859. line. For example: 
  4860.  
  4861. -- This query lists employee name,
  4862. -- years of employment, and salary
  4863.  
  4864. SELECT NAME, YEARS, SALARY   -- column names
  4865.   FROM STAFF                 -- table name
  4866.   ORDER BY NAME              -- sorted alphabetically
  4867.  
  4868. The comments are displayed only in the SQL statement field. They are not sent 
  4869. to the database. 
  4870.  
  4871.  
  4872. ΓòÉΓòÉΓòÉ 15.5. Using the results of an SQL statement ΓòÉΓòÉΓòÉ
  4873.  
  4874. After you submit or commit statements, check the Result field in the Enter SQL 
  4875. window for confirmation of your updates and any messages or return codes from 
  4876. the database. If you are running a SELECT statement, the results are displayed 
  4877. in different window. 
  4878.  
  4879. The statements you submit during this session also appear in the SQL History 
  4880. window. To display the SQL History window, select the Show history button from 
  4881. the Enter SQL window: 
  4882.  
  4883. From the SQL History window you can resubmit statements you already submitted, 
  4884. copy them to the Enter SQL window to edit and resubmit them, or copy them to 
  4885. the OS/2 clipboard. The statements remain in the window until you close it. 
  4886.  
  4887. To submit a statement: 
  4888.  
  4889.  1. Select one or more statements from those displayed in the window. 
  4890.  2. Select Submit from the Selected pull-down menu. 
  4891.  
  4892. To copy a statement to the Enter SQL window: 
  4893.  
  4894.  1. Select one or more statements from those displayed in the window. 
  4895.  2. Select Copy to SQL window from the Selected pull-down menu. 
  4896.  
  4897. To copy a statement to the clipboard: 
  4898.  
  4899.  1. Select one or more statements from those displayed in the window. 
  4900.  2. Select Copy from the Edit pull-down menu. 
  4901.  
  4902. When the database finishes processing an SQL statement, it returns messages and 
  4903. codes in the Result field of the Enter SQL window. 
  4904.  
  4905.  
  4906. ΓòÉΓòÉΓòÉ 15.6. Accessing an SQL Database object from your application ΓòÉΓòÉΓòÉ
  4907.  
  4908. Use the DBALIAS setup string keyname to access a specific database when 
  4909. invoking QUERY FOR OS/2 from your application. DBALIAS can set a default 
  4910. database alias in the SysCreateObject REXX utility object, the wpSetup 
  4911. Workplace Shell* object instance method, and the WinCreateObject Presentation 
  4912. Manager* function. The syntax is: 
  4913.  
  4914. DBALIAS=alias 
  4915.  
  4916. where the alias of the database is cataloged in the DB2/2 or CAE/2 database 
  4917. directory. The default value is no alias at all. 
  4918.  
  4919. See the OS/2 programming documentation for more information about setup string 
  4920. keynames. 
  4921.  
  4922. This example shows you how to use DBALIAS. The result is a working REXX EXEC. 
  4923.  
  4924. /* CREATEDB -- REXX exec to create a Workplace Shell SQL Database object */
  4925. /* 1. Copy this sample to a file named CREATEDB.CMD.                     */
  4926. /* 2. From an OS/2 Window, change to the directory containing this file  */
  4927. /* 3. Type createdb ? for instructions on how to use this command        */
  4928. /*-----------------------------------------------------------------------*/
  4929.  
  4930. /* Load the REXX SysCreateObject utility function */
  4931. call RxFuncAdd `SysCreateObject`, `RexxUtil`, `SysCreateObject`
  4932.  
  4933. parse arg title "(" aliasName        /* Get the title and database alias */
  4934.  
  4935. if title = `?` | title = `` then     /* Is caller asking for help?       */
  4936.   Signal Help
  4937.  
  4938. /* Ask Workplace Shell to create a SQLDatabase object on the Desktop.    */
  4939. /* If an alias was specified, pass that alias to the object using the    */
  4940. /* DBALIAS keyword in the setup string.                                  */
  4941. if aliasName = `` then               /* Was a database alias specified?  */
  4942.   setupString = ``                   /* ...no, so no special setup       */
  4943. else
  4944.   setupString = "DBALIAS="aliasName  /* ...yes, build a setup string     */
  4945.  
  4946. if SysCreateObject("IBMSQLDatabase",title,"<WP_DESKTOP>", setupString,"Fail") then
  4947.   Say `Object created successfully!`
  4948. else
  4949.   Say `Object creation failed....`
  4950. Say `Title=`title `  Location=Desktop   Database Reference=`aliasName
  4951. exit 0
  4952.  
  4953. Help:
  4954.   /* Get the name of this exec */
  4955.   parse source . . execPathAndName`.cmd` .
  4956.   myName = translate(SubStr(ExecPathAndName, LastPos("\", execPathAndName) + 1 ))
  4957.  
  4958.   say
  4959.   say myName "-- REXX exec to create a Workplace Shell SQL Database object"
  4960.   say
  4961.   say "Syntax:"
  4962.   say "  "myName "title ( aliasName"
  4963.   say
  4964.   say "  where:"
  4965.   say "    title     = the title to give the new SQL Database object"
  4966.   say "    aliasName = the name of the DB2/2 database alias the new object"
  4967.   say "                should use as the referenced database.  This alias"
  4968.   say "                must already be cataloged to DB2/2."
  4969.   say
  4970.   Say "Example:"
  4971.   say "  "myName "MySampleDatabase (SAMPLE"
  4972.   say
  4973.   exit 8
  4974.  
  4975.  
  4976. ΓòÉΓòÉΓòÉ 16. Improving data integrity, performance, and security ΓòÉΓòÉΓòÉ
  4977.  
  4978. SQL databases can contain many tables, each containing data of different 
  4979. origins and varying security levels. Use an SQL Table object to increase data 
  4980. integrity and enhance performance. Use SQL Table and SQL View objects to ensure 
  4981. data security. This chapter shows you how to do this by creating primary keys, 
  4982. constraints, indexes, and authorizations. 
  4983.  
  4984. This chapter also contains a general overview of referential integrity, 
  4985. performance, and privileges. Some of the information in this chapter may vary 
  4986. for your particular database. You can find specific information about these 
  4987. concepts in the library for your database. 
  4988.  
  4989.  
  4990. ΓòÉΓòÉΓòÉ 16.1. Maintaining integrity between tables ΓòÉΓòÉΓòÉ
  4991.  
  4992. Suppose your company keeps personnel information in tables in a database. One 
  4993. table, DEPARTMENT, lists all the departments in the company and the managers of 
  4994. those departments. Another table, EMPLOYEE, lists all the employees in the 
  4995. company and the departments that they work in. To ensure that every employee in 
  4996. the EMPLOYEE table is in a department listed in the DEPARTMENT table, you can 
  4997. use a concept called referential integrity. 
  4998.  
  4999.  
  5000. ΓòÉΓòÉΓòÉ 16.1.1. Building relationships between tables ΓòÉΓòÉΓòÉ
  5001.  
  5002. You can build relationships between and within tables to ensure that 
  5003. referential integrity is maintained. You can establish these relationships 
  5004. using constraints. Constraints ensure that the values in a column or set of 
  5005. columns in one table (called a primary key) match the values in a column or set 
  5006. of columns in the same or another table (called matching columns). 
  5007.  
  5008. Term                          Definition 
  5009. primary key                   A column, or an ordered collection of columns, 
  5010.                               whose values uniquely identify a row in a table. 
  5011. parent table                  The table in a constraint that contains the 
  5012.                               primary key. 
  5013. matching columns              A column, or set of columns, in a table 
  5014.                               containing values that are also contained in the 
  5015.                               primary key of the parent table. The values in 
  5016.                               the matching column do not have to be unique, but 
  5017.                               they must be represented in the primary key. 
  5018. referenced table              The table in a constraint that contains the 
  5019.                               matching columns. The parent table and the 
  5020.                               referenced table can be the same. 
  5021.  
  5022. In the tables below, the DEPTNO column in the DEPARTMENT table and the WRKDEPT 
  5023. column in the EMPLOYEE table create a constraint. 
  5024.  
  5025. ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ  ΓöîΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö¼ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÉ
  5026. Γöé DEPTNO  Γöé DEPTNAME   Γöé MGRNO  Γöé  Γöé EMPNO  Γöé LASTNAME  Γöé FIRSTNAME Γöé WRKDEPT  Γöé
  5027. Γöé (Primary Γöé       Γöé     Γöé  Γöé     Γöé      Γöé      Γöé (Matching Γöé
  5028. Γöé  Key)   Γöé       Γöé     Γöé  Γöé     Γöé      Γöé      Γöé  Column)  Γöé
  5029. Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ  Γö£ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö╝ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöñ
  5030. Γöé  A00   Γöé Finance   Γöé 000010 Γöé  Γöé 000014 Γöé Haas    Γöé Christine Γöé C01    Γöé
  5031. Γöé  B01   Γöé Planning   Γöé 000020 Γöé  Γöé 000027 Γöé Kwan    Γöé Sally   Γöé D11    Γöé
  5032. Γöé  C01   Γöé Marketing  Γöé 000030 Γöé  Γöé 000033 Γöé O'Connell Γöé Sean    Γöé A00    Γöé
  5033. Γöé  D11   Γöé Development Γöé 000060 Γöé  Γöé 000059 Γöé Nicholls  Γöé Heather  Γöé C01    Γöé
  5034. ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ  ΓööΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓö┤ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÿ
  5035. DEPARTMENT table (parent table)    EMPLOYEE table (referenced table)
  5036.  
  5037.  
  5038. ΓòÉΓòÉΓòÉ 16.1.1.1. Using a primary key ΓòÉΓòÉΓòÉ
  5039.  
  5040. A primary key must exist before you create a constraint. A primary key must be 
  5041. unique. This means that: 
  5042.  
  5043. o When a primary key is made up of one column in a table, each value in that 
  5044.   column must be unique (different). 
  5045.  
  5046. o When a primary key is made up of two or more columns in a table (specified in 
  5047.   a certain order), the values in each column do not have to be unique, but the 
  5048.   collection of values representing each row must be unique. 
  5049.  
  5050.  
  5051. ΓòÉΓòÉΓòÉ 16.1.1.2. Creating a primary key ΓòÉΓòÉΓòÉ
  5052.  
  5053. QUERY FOR OS/2 simplifies creating a primary key by determining which columns 
  5054. in your table can be included in the primary key, and displaying these columns 
  5055. in the Available Columns list on the Primary Key page of the notebook. You 
  5056. create the primary key by choosing columns from the list, then selecting Apply 
  5057. all. You cannot delete a primary key after it is applied to the database. 
  5058.  
  5059. To create a primary key: 
  5060.  
  5061.  1. Open the notebook for the table. 
  5062.  
  5063.  2. On the Primary key page, double-click on each column name in the Available 
  5064.     Columns list that you want to add to the primary key. As you add columns, 
  5065.     the column names are removed from the Available Columns list and displayed 
  5066.     in the Key Columns list. 
  5067.  
  5068.  3. To delete columns from the primary key, double-click on each column name in 
  5069.     the Key Columns list that you want to delete. 
  5070.  
  5071.  4. Select Apply all on the Table page to apply the changes to the database, 
  5072.     and close the notebook. 
  5073.  
  5074.  
  5075. ΓòÉΓòÉΓòÉ 16.1.2. Maintaining integrity when deleting data ΓòÉΓòÉΓòÉ
  5076.  
  5077. You might need to delete rows from a table that is used in a constraint. For 
  5078. example, if two departments in the company are merged into one, the old 
  5079. department numbers from the DEPARTMENT table should be deleted and replaced 
  5080. with the number for the new department. But by deleting the old department 
  5081. numbers from the DEPARTMENT table, the referential integrity of the EMPLOYEE 
  5082. table is compromised, because there are now employees assigned to departments 
  5083. that do not exist. 
  5084.  
  5085.  
  5086. ΓòÉΓòÉΓòÉ 16.1.2.1. Using delete rules ΓòÉΓòÉΓòÉ
  5087.  
  5088. In situations like this, a delete rule is used to maintain the integrity of the 
  5089. data. The delete rule, which is part of the constraint, determines what happens 
  5090. to those rows in the referenced table (called dependent rows) whose values 
  5091. match the value in the row being deleted from the parent table. 
  5092.  
  5093. The delete rules are: 
  5094.  
  5095. Restrict  If a value in a dependent row matches the primary key value in the 
  5096.           row being deleted from the parent table, no rows are deleted from the 
  5097.           parent table or from the dependent table. 
  5098.  
  5099.           Using this rule, you could not delete department C01 from the 
  5100.           DEPARTMENT table because there are dependent rows in the EMPLOYEE 
  5101.           table that contain the same value. Therefore, both tables would stay 
  5102.           as they are. 
  5103.  
  5104. Cascade   All dependent rows with values that match the primary key value in 
  5105.           the row being deleted from the parent table are deleted, along with 
  5106.           the row in the parent table. 
  5107.  
  5108.           Using this rule, all rows in the EMPLOYEE table containing the value 
  5109.           C01 are deleted if you deleted department C01 from the DEPARTMENT 
  5110.           table. 
  5111.  
  5112. Nullify   If a value in a dependent row matches the primary key value in the 
  5113.           row being deleted from the parent table, the row in the parent table 
  5114.           is deleted and the value in the dependent row is set to a null value. 
  5115.  
  5116.           Using this rule, every occurrence of the value C01 in the EMPLOYEE 
  5117.           table would change to a blank (null) if you deleted department C01 
  5118.           from the DEPARTMENT table. 
  5119.  
  5120. The following sections show you how to create and delete constraints. 
  5121.  
  5122.  
  5123. ΓòÉΓòÉΓòÉ 16.1.2.2. Creating a constraint ΓòÉΓòÉΓòÉ
  5124.  
  5125. Before you add a constraint to a table, the following criteria must be met: 
  5126.  
  5127. o The referenced table must exist. 
  5128.  
  5129. o The referenced table must have a primary key defined. 
  5130.  
  5131. o The matching columns must have the same data type and width as the primary 
  5132.   key columns in the referenced table. 
  5133.  
  5134. o You must have references authority on the referenced table and alter 
  5135.   authority on the table containing the matching columns. See your SQL 
  5136.   reference for more information on references authority and alter authority. 
  5137.  
  5138. You can delete constraints that are no longer needed. You can also create 
  5139. additional constraints and view information about existing constraints. You can 
  5140. modify an existing constraint only by deleting it and then recreating it with 
  5141. the new information. 
  5142.  
  5143. To create a new constraint: 
  5144.  
  5145.  1. Open the notebook. 
  5146.  
  5147.  2. On the Constraints page, type a name for the constraint in the Name field. 
  5148.  
  5149.  3. Select a radio button to specify the Delete Rule. 
  5150.  
  5151.  4. Type the table name and collection name of the Referenced Table, or select 
  5152.     Table List to search for a referenced table. 
  5153.  
  5154.  5. Select Add to add the constraint. 
  5155.  
  5156.  6. If you want to add more constraints, select Clear to clear the fields, then 
  5157.     repeat steps 2 through 5 
  5158.  
  5159.  7. Select Apply all on the Table page to apply the changes to the database, 
  5160.     and close the notebook. 
  5161.  
  5162. The names of the constraints on the table are displayed in the Constraints 
  5163. list. 
  5164.  
  5165.  1. Open the notebook. 
  5166.  
  5167.  2. On the Constraints page, double-click on each constraint in the Constraints 
  5168.     list that you want to delete. 
  5169.  
  5170.  3. Select Apply all on the Table page to apply the changes to the database, 
  5171.     and close the notebook. 
  5172.  
  5173.  
  5174. ΓòÉΓòÉΓòÉ 16.2. Improving data access with indexes ΓòÉΓòÉΓòÉ
  5175.  
  5176. When you run a query on a table that does not have an index, the database reads 
  5177. each row in a table to determine if that row should be retrieved. When you 
  5178. create an index for a table, the database does not read every row in a table. 
  5179. Instead, it refers to the index and follows the pointers to retrieve the 
  5180. necessary rows. This speeds up the time it takes to retrieve the data. 
  5181.  
  5182. A simple index is basically a two-column list. The first column contains a set 
  5183. of values, which represent values in the table. This column is referred to as 
  5184. the index key. 
  5185.  
  5186. The second column in the index contains pointers from the index key to the rows 
  5187. in the table where those values exist. 
  5188.  
  5189. You can create two types of indexes: nonunique or unique. A nonunique index 
  5190. contains duplicate values, but a unique index does not. 
  5191.  
  5192. You can include one or more columns in the index key. Columns that are used 
  5193. frequently when selecting, joining, grouping, or ordering data are good choices 
  5194. for an index. 
  5195.  
  5196. You can create more than one index on a table. However, specifying a large 
  5197. number of columns in an index, or creating many indexes for a table, can 
  5198. increase database processing time. 
  5199.  
  5200. You can delete indexes from a table that is applied to the database. 
  5201.  
  5202. To see if indexes are already defined on the table, open the notebook to the 
  5203. Indexes page and look at the Indexes list. 
  5204.  
  5205. To create an index or add a new index to a table: 
  5206.  
  5207.  1. Open the notebook. 
  5208.  
  5209.  2. On the Indexes page, type the name of a new index in the Name field. 
  5210.  
  5211.  3. Select a button under Allow duplicate rows to specify whether several rows 
  5212.     in the index can contain the same values. Choose Yes to create a nonunique 
  5213.     index, or No to create a unique index. 
  5214.  
  5215.  4. Select a column to be included in the index key from the Available Columns 
  5216.     list. 
  5217.  
  5218.  5. Select a button under Order to specify the sorting order for the column. 
  5219.     Select Ascending to order the column from lowest to highest (for example, 1 
  5220.     to 9) or Descending to order it from highest to lowest (for example, 9 to 
  5221.     1). 
  5222.  
  5223.  6. Select Add in the Index Definition area to add the column to the index key. 
  5224.     When you add a column to the index key, it is removed from the Available 
  5225.     Columns list and displayed in the Key Columns list. 
  5226.  
  5227.  7. To add more columns to the index, select Clear on the Indexes page to clear 
  5228.     the fields, then repeat steps 4, 5, and 6 for each additional column. 
  5229.  
  5230.  8. Select Add in the Indexes list to add the index. The index name is 
  5231.     displayed in the Indexes list. 
  5232.  
  5233.  9. Select Apply all on the Table page to apply the changes to the database, 
  5234.     and close the notebook. 
  5235.  
  5236. To delete an index: 
  5237.  
  5238.  1. Open the notebook. 
  5239.  
  5240.  2. On the Indexes page, select an index name from the Indexes list. 
  5241.  
  5242.  3. Select Delete. 
  5243.  
  5244.  4. Select Apply all on the Table page to apply the changes to the database, 
  5245.     and close the notebook. 
  5246.  
  5247.  
  5248. ΓòÉΓòÉΓòÉ 16.3. Sharing data with others ΓòÉΓòÉΓòÉ
  5249.  
  5250. Often, tables or views are owned by a single person, but needed by many people. 
  5251. However, not all people need the same access to the data. Some people might 
  5252. need to update data, while others might need only to look at the data. 
  5253.  
  5254. You can grant privileges for tables and views that you own, or have grant 
  5255. authority for. Privileges are different types of accesses for a particular 
  5256. table or view. Privileges can be given to a single user or a group of users. 
  5257. Granting a privilege on a specific table or view creates an authorization. You 
  5258. can also add to and delete authorizations that you previously granted. 
  5259.  
  5260.  
  5261. ΓòÉΓòÉΓòÉ 16.3.1. Authorizing users ΓòÉΓòÉΓòÉ
  5262.  
  5263. You can authorize one, some, or all users in your company to access tables and 
  5264. views that you own. 
  5265.  
  5266. To authorize users: 
  5267.  
  5268.  1. Open the notebook. 
  5269.  
  5270.  2. On the Authorization page, select Clear to clear the fields. 
  5271.  
  5272.  3. Type a collection name in the User Name field. The collection name could be 
  5273.     a user ID or some other identifier of the user or user group. Type PUBLIC 
  5274.     to authorize users who have access to the database where the table or view 
  5275.     is stored, or PUBLIC AT ALL LOCATIONS to authorize users on local and 
  5276.     remote databases. 
  5277.  
  5278.     PUBLIC AT ALL LOCATIONS is not available on all databases. See your SQL 
  5279.     reference for more information. 
  5280.  
  5281.  4. Select the privileges being granted from the Authorizations list. 
  5282.  
  5283.  5. If the database the view is stored in is DB2 for MVS, you can allow users 
  5284.     to grant the same privileges they are authorized for to other users. 
  5285.  
  5286.     Select the privileges the user will be authorized to grant from the Grant 
  5287.     list. You can authorize the user to grant any privilege specified in step 4 
  5288.  
  5289.  6. Select Add. The collection name is enclosed in brackets, indicating that it 
  5290.     is not applied to the database. When the collection name is applied, the 
  5291.     brackets are removed. 
  5292.  
  5293.  7. Repeat steps 2 through 6 for each collection name. 
  5294.  
  5295.  8. Select Apply all on the Table or View page, and close the notebook. 
  5296.  
  5297.  
  5298. ΓòÉΓòÉΓòÉ 16.3.2. Updating privileges for existing users ΓòÉΓòÉΓòÉ
  5299.  
  5300. You can grant additional privileges on a table or view, or you can revoke 
  5301. privileges. 
  5302.  
  5303. To update privileges: 
  5304.  
  5305.  1. Open the notebook. 
  5306.  
  5307.  2. On the Authorization page, select a collection name from the Authorized 
  5308.     users list. 
  5309.  
  5310.  3. In the Authorizations list, select the privileges being granted, or 
  5311.     deselect the privileges being revoked. 
  5312.  
  5313.  4. Select Modify. 
  5314.  
  5315.  5. Select Apply all on the Table or View page to apply the changes to the 
  5316.     database, and close the notebook. 
  5317.  
  5318.  
  5319. ΓòÉΓòÉΓòÉ 16.3.3. Deleting users from an authorized group ΓòÉΓòÉΓòÉ
  5320.  
  5321. You can revoke all privileges for a user or group of users. 
  5322.  
  5323. To revoke privileges: 
  5324.  
  5325.  1. Open the notebook to the Authorization page. 
  5326.  
  5327.  2. Select a name from the Authorized users list. 
  5328.  
  5329.  3. Select Delete. 
  5330.  
  5331.  4. Repeat steps 2 and 3 for each name you want to delete. 
  5332.  
  5333.  5. After you delete all required collection names, select Apply all on the 
  5334.     Table or View page to apply the changes to the database, and close the 
  5335.     notebook. 
  5336.  
  5337.  
  5338. ΓòÉΓòÉΓòÉ 17. Creating effective SQL statements ΓòÉΓòÉΓòÉ
  5339.  
  5340. If you are familiar with SQL, you can define an SQL Statement to retrieve data 
  5341. from a database, to create or delete a table or view in a database, to prepare 
  5342. an index on a table, or to grant and revoke privileges on a database. You can 
  5343. store your SQL Statement and allow other users, who may have no knowledge of 
  5344. SQL, to run it and use any result produced. 
  5345.  
  5346. This chapter describes which SQL statements can be used in an SQL Statement 
  5347. object, when changes are committed to the database, and how to import queries 
  5348. from other products. It also provides techniques and suggestions for defining 
  5349. effective SQL statements that you and your co-workers will find easy to use. 
  5350.  
  5351.  
  5352. ΓòÉΓòÉΓòÉ 17.1. Defining and running SQL statements ΓòÉΓòÉΓòÉ
  5353.  
  5354. QUERY FOR OS/2 offers two ways to define and run SQL statements: 
  5355.  
  5356. o If you are working with the tables and views in an SQL Database object, you 
  5357.   can use the Enter SQL window in the object to run statements in that 
  5358.   database. Use the Enter SQL window for defining: 
  5359.  
  5360.    - Statements you run occasionally 
  5361.  
  5362.    - Database administration statements 
  5363.  
  5364.    - Multiple SQL statements 
  5365.  
  5366.    - Statements with active cursors, with which you can retrieve a set of rows 
  5367.      from a table. 
  5368.  
  5369.   Enter SQL can run any statement except CONNECT. 
  5370.  
  5371.   For further information about the Enter SQL window, see Running SQL 
  5372.   statements. 
  5373.  
  5374. o If you run a certain SQL statement frequently, or you want to store a 
  5375.   statement and use its result in a report, use an SQL Statement object. Use an 
  5376.   SQL Statement object when: 
  5377.  
  5378.    - You use the same statement frequently 
  5379.  
  5380.    - You want to use the result of a SELECT statement to create a report 
  5381.  
  5382.    - You are importing a statement from a plain text file, such as an SQL query 
  5383.      exported from QMF or Query Manager/400 
  5384.  
  5385.    - You are importing a Prompted Query or an SQL query exported from Query 
  5386.      Manager 
  5387.  
  5388. To define an SQL Statement object: 
  5389.  
  5390.  1. Create a new SQL Statement and rename it. See Common OS/2 tasks for 
  5391.     information on how to do this. 
  5392.  
  5393.  2. Open the SQL Statement. 
  5394.  
  5395.  3. Associate the SQL Statement with a database by selecting from the Database 
  5396.     list. 
  5397.  
  5398.     The SQL Statement connects to this database when you run it, but the SQL 
  5399.     Statement is not stored in the database. 
  5400.  
  5401.  4. Type your SQL statement in the entry field. 
  5402.  
  5403.     An SQL Statement can contain a single SQL statement with appropriate 
  5404.     subclauses. Most of the common statements for selecting data, for creating 
  5405.     and deleting tables and views, for creating indexes, and for granting and 
  5406.     revoking privileges are supported. See the next section for more detailed 
  5407.     information on the supported SQL statements. 
  5408.  
  5409.     You can edit your SQL Statement using the standard keyboard editing keys 
  5410.     (for example, Home and Delete), or by using the clipboard. Select the Cut, 
  5411.     Copy or Paste choices from the Edit menu to use the clipboard. 
  5412.  
  5413.  5. Select the Save choice from the SQL menu. 
  5414.  
  5415.  
  5416. ΓòÉΓòÉΓòÉ 17.2. Which SQL statements can I use? ΓòÉΓòÉΓòÉ
  5417.  
  5418. You can use a single supported SQL statement with appropriate subclauses in an 
  5419. SQL Statement object. The supported statements are executable SQL statements 
  5420. that can be dynamically prepared. This includes the most common statements for 
  5421. the following tasks: 
  5422.  
  5423. Task                                    Typical supported statements 
  5424. Creating tables and views               CREATE TABLE 
  5425.                                         CREATE VIEW 
  5426. Updating tables and views               INSERT 
  5427.                                         UPDATE 
  5428.                                         DELETE 
  5429.                                         ALTER TABLE 
  5430. Creating an index                       CREATE INDEX 
  5431. Selecting data                          SELECT 
  5432. Deleting tables and views               DROP 
  5433. Controlling access to data              GRANT 
  5434.                                         REVOKE 
  5435.                                         LOCK TABLE 
  5436.  
  5437. SQL statements that define and control cursors directly and statements that use 
  5438. host variables are not supported. 
  5439.  
  5440.  
  5441. ΓòÉΓòÉΓòÉ 17.3. Committing changes ΓòÉΓòÉΓòÉ
  5442.  
  5443. Because SQL Statement issues a COMMIT statement after you run it, you should 
  5444. not use COMMIT or ROLLBACK within an SQL statement. 
  5445.  
  5446. The SQL Statement template provided with QUERY FOR OS/2 has the push button 
  5447. selected on the tool bar. An SQL Statement created from this template does not 
  5448. commit changes to the database until you confirm that you want to do this in 
  5449. response to a message. 
  5450.  
  5451. Select from the tool bar to have changes committed to the database as soon as 
  5452. the SQL Statement is run, without prompting you. 
  5453.  
  5454.  
  5455. ΓòÉΓòÉΓòÉ 17.4. Making an SQL statement reusable ΓòÉΓòÉΓòÉ
  5456.  
  5457. You can make an SQL Statement reusable by using variable values in its 
  5458. definition. You assign a specific value to the variables when the SQL Statement 
  5459. is run. 
  5460.  
  5461. For example, consider the following SELECT statement: 
  5462.  
  5463. SELECT * FROM CUSTOMER
  5464. WHERE STATE = (SELECT STATE FROM CUSTOMER
  5465.                WHERE "Customer Name" = `@Customer_name`)
  5466.  
  5467. When run, this statement shows you all the customers with addresses in the same 
  5468. state as the customer whose name you specify. 
  5469.  
  5470. When you run this SQL Statement, the Value Substitution window is displayed. 
  5471.  
  5472. Type the customer name of your choice, and select OK. The variable value in the 
  5473. SELECT statement is replaced with the name you type before the data is 
  5474. retrieved. 
  5475.  
  5476.  
  5477. ΓòÉΓòÉΓòÉ 17.4.1. Naming variable values ΓòÉΓòÉΓòÉ
  5478.  
  5479. A variable value must consist of an @ character followed by up to 20 
  5480. characters. The characters must comprise alphanumeric characters or the 
  5481. underscore character. The first character after the @ cannot be a number. 
  5482. Spaces cannot be used within the variable. For example: 
  5483.  
  5484. Valid               Not valid 
  5485. @var1               @%1 
  5486. @Customer_number    @Customer number 
  5487. @Address1           @1Address 
  5488.  
  5489. You can use any number of variable values anywhere in an SQL statement. For 
  5490. example, you can use a variable value for a keyword, a table name, or a 
  5491. selection criterion. 
  5492.  
  5493.  
  5494. ΓòÉΓòÉΓòÉ 17.4.2. Tips on using variable values ΓòÉΓòÉΓòÉ
  5495.  
  5496. Use the following tips to make your variable values user-friendly: 
  5497.  
  5498. o Use meaningful names for the variable values. 
  5499.  
  5500.   Variable values are shown next to an entry field in the Value Substitution 
  5501.   window when the SQL Statement is run. It is much easier to remember what to 
  5502.   type next to a value such as "Customer_name" than a value such as "var1". 
  5503.  
  5504. o Provide a cue in the icon name. 
  5505.  
  5506.   Include a word such as "any" in the icon name to provide a visual reminder 
  5507.   that your SQL Statement asks the user to type values for its variables. For 
  5508.   example, Weekly sales comparison - any 2 products. 
  5509.  
  5510.  
  5511. ΓòÉΓòÉΓòÉ 17.5. Tips on defining SQL statements for use by others ΓòÉΓòÉΓòÉ
  5512.  
  5513. When you define SQL Statements for others to run, there are a number of tips 
  5514. you can follow to simplify both using and maintaining the SQL Statements. Some 
  5515. of these tips are more obvious than others. The following sections give a brief 
  5516. summary of them. 
  5517.  
  5518.  
  5519. ΓòÉΓòÉΓòÉ 17.5.1. Naming icons ΓòÉΓòÉΓòÉ
  5520.  
  5521. Help your users identify an SQL Statement by giving the desktop icon a 
  5522. meaningful name. For example, if the SQL Statement selects sales figures from 
  5523. tables updated weekly for the ten best-selling products, a good title would be 
  5524. Top 10 sellers - Last week. 
  5525.  
  5526. For information on how to change the name of an icon, see Common OS/2 tasks. 
  5527.  
  5528.  
  5529. ΓòÉΓòÉΓòÉ 17.5.2. Running an object by double-clicking ΓòÉΓòÉΓòÉ
  5530.  
  5531. If your users often run an SQL Statement, but rarely or never make changes to 
  5532. it, you can make life simpler for them by changing the default Open action. 
  5533. Your users can then run the SQL Statement by double-clicking on its icon. 
  5534.  
  5535. To change the default Open action: 
  5536.  
  5537.  1. Display the pop-up menu for the icon. 
  5538.  2. Select the arrow to the right of Open. 
  5539.  3. Select Settings. The SQL statement notebook is displayed. 
  5540.  4. Select the Menu notebook page. 
  5541.  5. In the Available menus list, select ~Open. 
  5542.  6. Select the Settings push button. The Menu Settings window is displayed. 
  5543.  7. In the Default action list, select Run SQL. 
  5544.  8. Select OK. 
  5545.  9. Close the SQL statement notebook. 
  5546.  
  5547. Your users can still open the object in the usual way by using the pop-up menu 
  5548. for the icon. 
  5549.  
  5550.  
  5551. ΓòÉΓòÉΓòÉ 17.5.3. Changing the associated database ΓòÉΓòÉΓòÉ
  5552.  
  5553. If you create an SQL Statement that can be associated with several databases, 
  5554. save it with a blank entry in the Database list. Users can then temporarily 
  5555. associate it with any of their databases. 
  5556.  
  5557. If you do this, make the SQL Statement read-only, and do not change the default 
  5558. Open action of the object. 
  5559.  
  5560.  
  5561. ΓòÉΓòÉΓòÉ 17.5.4. Preventing accidental changes ΓòÉΓòÉΓòÉ
  5562.  
  5563. If you want users to be able to change an SQL Statement, but also want to 
  5564. minimize accidental changes, there are two steps you can take: 
  5565.  
  5566. o Ensure that when you save the SQL Statement, the push button is selected on 
  5567.   the tool bar. The SQL Statement cannot then be edited until the push button 
  5568.   is selected on the tool bar. 
  5569.  
  5570. o Ensure that Confirm is selected on the SQL menu. Any changes to the database 
  5571.   are made only when the user confirms them in response to a message. 
  5572.  
  5573.  
  5574. ΓòÉΓòÉΓòÉ 17.5.5. Preventing all changes ΓòÉΓòÉΓòÉ
  5575.  
  5576. If none of your users need to change the SQL Statement, or if several users 
  5577. access the same icon on a LAN, you can prevent any changes by making the SQL 
  5578. Statement a read-only file. 
  5579.  
  5580. To make an SQL Statement a read-only file: 
  5581.  
  5582.  1. Open the settings notebook for the SQL Statement. 
  5583.  2. Select the File notebook tab. 
  5584.  3. Select the right arrow at the bottom of the page to display Page 2 of the 
  5585.     File section. 
  5586.  4. In Flags, select Read-only, then close the notebook. 
  5587.  
  5588. Alternatively, if the SQL Statement is stored on a LAN resource, you can make 
  5589. the entire resource read-only. 
  5590.  
  5591.  
  5592. ΓòÉΓòÉΓòÉ 17.6. Importing queries from other products ΓòÉΓòÉΓòÉ
  5593.  
  5594. You can import the following queries from other products: 
  5595.  
  5596. o SQL queries and prompted queries produced by Query Manager 
  5597.  
  5598. o Plain text SQL queries produced by other query products, for example, QMF or 
  5599.   Query Manager/400 
  5600.  
  5601. To import a Query Manager query: 
  5602.  
  5603.  1. Select Import QM from the SQL menu. The Import window is displayed. 
  5604.  
  5605.     A list of all the SQL databases cataloged on your workstation is shown in 
  5606.     the Locations list. 
  5607.  
  5608.  2. Select a database in the Locations list. 
  5609.  
  5610.     A list of all collection names associated with the selected database is 
  5611.     shown in the Locations list. The collection name (sometimes called the 
  5612.     table prefix) is usually the same as the user ID of the person who created 
  5613.     the tables and views. 
  5614.  
  5615.  3. Select a collection name in the Locations list. 
  5616.  
  5617.     A list of queries identified by the selected collection name is shown in 
  5618.     the Names list. 
  5619.  
  5620.  4. Double-click on the query you want in the Names list. 
  5621.  
  5622. If the query contains lines that are longer than 254 characters, the part of 
  5623. the line after the 254th character will be wrapped onto the next line. This may 
  5624. create a statement that is not valid in SQL. However, you can open the 
  5625. resulting SQL Statement and edit the lines to create a valid statement. 
  5626.  
  5627. To import a plain text (.TXT) file: 
  5628.  
  5629.  1. Select Import text from the SQL menu. The Import window is displayed. 
  5630.  
  5631.  2. Type the name of the file in the Name field, or select it from the Names 
  5632.     list. 
  5633.  
  5634.  3. Type the location of the file in the Location field, or select it from the 
  5635.     Locations list. 
  5636.  
  5637.  4. Select OK. 
  5638.  
  5639. If the query contains lines that are longer than 254 characters, the part of 
  5640. the line after the 254th character will be truncated. Open the new SQL 
  5641. Statement and retype that part of the line. 
  5642.  
  5643.  
  5644. ΓòÉΓòÉΓòÉ 17.7. Saving an SQL Statement ΓòÉΓòÉΓòÉ
  5645.  
  5646. To save an SQL Statement on the OS/2 file system, select Save on the SQL menu. 
  5647.  
  5648. You cannot select Save if you do not have write access to the SQL Statement 
  5649. that you have opened. However, you can select Copy to from the SQL menu and 
  5650. save the SQL Statement using a different file name or location. 
  5651.  
  5652.  
  5653. ΓòÉΓòÉΓòÉ 17.8. Printing an SQL Statement ΓòÉΓòÉΓòÉ
  5654.  
  5655. To print an SQL Statement, drag it and drop it on a printer object. You can 
  5656. drag either the icon of a closed SQL Statement, or the title-bar small icon of 
  5657. an open SQL Statement. 
  5658.  
  5659.  
  5660. ΓòÉΓòÉΓòÉ 18. Customizing Query for OS/2 objects ΓòÉΓòÉΓòÉ
  5661.  
  5662. Use the Profile notebook to customize settings used by all QUERY FOR OS/2 
  5663. objects. The notebook includes sections called Visualizer, SQL, Window, and 
  5664. General. The Window and General sections are the same as all other OS/2 
  5665. objects; refer to OS/2 online help or documentation for more information about 
  5666. these sections. 
  5667.  
  5668. This chapter covers the Visualizer and SQL sections of the notebook, and the 
  5669. Language section used for bidirectional languages. 
  5670.  
  5671.  
  5672. ΓòÉΓòÉΓòÉ 18.1. Changing your Visualizer profile options ΓòÉΓòÉΓòÉ
  5673.  
  5674. Use the first page of the Visualizer section to set the national language, 
  5675. currency and number representation, and common operations. 
  5676.  
  5677. Language       Select the language you want to work in. For example, to work in 
  5678.                U.S. English, select ENU. 
  5679. Currency       Specify the symbol to be used when displaying currency figures. 
  5680.                You can also specify the position of the currency symbol. 
  5681. Numbers        Specify: 
  5682.  
  5683.    o The character to be used as the thousands separator 
  5684.    o The character to be used as the decimal separator 
  5685.    o The number of decimal places to be displayed 
  5686. Common         Specify if you want: 
  5687.  
  5688.    o To be prompted when you try to replace an existing Visualizer object with 
  5689.      an object you are trying to save. 
  5690.  
  5691.    o To view or change the print settings each time you print an object. 
  5692.  
  5693.    o To display the names of shortcut keys to be on object menus. 
  5694.  
  5695.    o To run a query when you open it. 
  5696.  
  5697. Use the second page to set the date and time formats. 
  5698.  
  5699. Date format    Enter the short and formal date formats to be used when 
  5700.                displaying dates. In the Date separator field, type the 
  5701.                character to be used to separate the month, day, and year. 
  5702. Time format    Enter the time format to be used when displaying times. In the 
  5703.                Time separator field, type the character to be used to separate 
  5704.                the hours, minutes, and seconds. 
  5705.  
  5706. Use the third page to set options for connecting to AS. 
  5707.  
  5708. Profile             Specify the server profile to be used to establish the 
  5709.                     connection to AS. The default is DASSERV. 
  5710. Logon command       Specify the name of the command file that is used to log on 
  5711.                     to the host computer. The default is blank. Two command 
  5712.                     files are supplied with QUERY FOR OS/2: FTBLNVM.CMD (for 
  5713.                     VM), and FTBLNMV (for MVS). 
  5714. AS setup code       Specify the parameters to be used when AS is started. This 
  5715.                     field should be used to specify a default application code. 
  5716. Host codepage       Specify the translation table to be used when transferring 
  5717.                     data between AS and Visualizer. 
  5718.  
  5719.  
  5720. ΓòÉΓòÉΓòÉ 18.2. Changing your SQL profile options ΓòÉΓòÉΓòÉ
  5721.  
  5722. The SQL section contains the settings used when browsing or updating SQL tables 
  5723. or SQL views. 
  5724.  
  5725. Fetch limit                   Specify the maximum number of rows that can be 
  5726.                               read from a database table or view. The default 
  5727.                               is 2000. The limit can be from 1 through 64000 
  5728.                               rows. 
  5729. Data Viewer timeout           Specify how long the Data Viewer can remain 
  5730.                               unused before the data is rolled back. 
  5731.  
  5732.    Timeout radio button and spin button Specify how long the Data Viewer can 
  5733.                   remain unused. Select Timeout and set the number of minutes 
  5734.                   (from 1 through 99). 
  5735.  
  5736.                   The default timeout is 10 minutes. 
  5737.    No timeout     Select this if you do not want the data to be rolled back 
  5738.                   after a specific period. 
  5739. Read locking                  Specify how a database table or view is locked 
  5740.                               when it is read from the Data Viewer. 
  5741.  
  5742.    Uncommitted read Enables you to read a table, ignoring any database locks. 
  5743.                   However, because this option does not lock the table, other 
  5744.                   people can update the table when you are updating it. The 
  5745.                   latest data is fetched, even when this data has not yet been 
  5746.                   committed to the database. 
  5747.    Cursor stability Enables you to open a table and lock the rows as they are 
  5748.                   fetched. This prevents other people from updating the locked 
  5749.                   rows while you are working with them. This is the default. 
  5750.    Repeatable read Behaves like Cursor Stability, except that read locks are 
  5751.                   not released as you scroll through the data. When you select 
  5752.                   a set of data, all the data in that set is locked. The data 
  5753.                   is unlocked when you select a new set of data, or when you 
  5754.                   scroll through all the fetched data. 
  5755. Update locking                Specify how a database table or view is locked 
  5756.                               when you open it in update mode from the Data 
  5757.                               Viewer. 
  5758.  
  5759.    Exclusive      Gives you exclusive control over the table. No one else can 
  5760.                   update the data when you are updating it. This is the 
  5761.                   default. 
  5762.    Shared         Enables other people to read and update the table when you 
  5763.                   are updating it, provided that they are using different parts 
  5764.                   of the table. 
  5765.  
  5766.  
  5767. ΓòÉΓòÉΓòÉ 18.3. Changing your settings for bidirectional languages ΓòÉΓòÉΓòÉ
  5768.  
  5769. When you install Visualizer products with bidirectional versions of OS/2, the 
  5770. Profile notebook contains a Language section. You can use this to change the 
  5771. settings for your language. Not all bidirectional languages are the same; only 
  5772. the applicable settings appear in the Language section. 
  5773.  
  5774.  
  5775. ΓòÉΓòÉΓòÉ 18.3.1. Deciding how data is displayed and exchanged ΓòÉΓòÉΓòÉ
  5776.  
  5777. Use the first page of the Language section to set options for displaying and 
  5778. exchanging data. Some bidirectional languages do not require character or 
  5779. numeral shaping. 
  5780.  
  5781. It is important that you use suitable settings when you are transferring data 
  5782. between VM/AS or AS/400 databases and Visualizer. The following sections 
  5783. describe the settings you should use. 
  5784.  
  5785.  
  5786. ΓòÉΓòÉΓòÉ 18.3.1.1. Settings for VM/AS ΓòÉΓòÉΓòÉ
  5787.  
  5788. If you are transferring data to or from VM/AS, use these settings: 
  5789.  
  5790. Text Type                Visual 
  5791. Character Shape          Save Shaped 
  5792.  
  5793.  
  5794. ΓòÉΓòÉΓòÉ 18.3.1.2. Settings for AS/400 databases ΓòÉΓòÉΓòÉ
  5795.  
  5796. If you are transferring data to or from AS/400 databases, use these settings: 
  5797.  
  5798. Text Type                Visual 
  5799. Text Orientation         Left to Right 
  5800. Symmetric Swapping       Off 
  5801. Character Shape          Save Shaped 
  5802.  
  5803.  
  5804. ΓòÉΓòÉΓòÉ 18.3.1.3. Settings for local data ΓòÉΓòÉΓòÉ
  5805.  
  5806. If you are using local data on your own workstation (for example, data in 
  5807. Visualizer tables), use these settings: 
  5808.  
  5809. Text Type                Implicit (this gives better sorting and searching 
  5810.                          results) 
  5811. Character Shape          Automatic (this is best if Text Type is Implicit) 
  5812. Numeral Shape            Context (this is best if Text Type is Implicit) 
  5813.  
  5814.  
  5815. ΓòÉΓòÉΓòÉ 18.3.2. Changing keyboard operations ΓòÉΓòÉΓòÉ
  5816.  
  5817. Use the second page of the Language section to change the way Visualizer 
  5818. accepts keyboard data, and to use specific hot-keys. Some bidirectional 
  5819. languages do not require the character or numeral shaping hot-keys that are set 
  5820. by the check boxes from Automatic to Save Shaped in 
  5821.  
  5822.  
  5823. ΓòÉΓòÉΓòÉ 19. Using Query for OS/2 objects from the OS/2 command line ΓòÉΓòÉΓòÉ
  5824.  
  5825. You can use the OS/2 command line to open, run, print, and create QUERY FOR 
  5826. OS/2 objects. 
  5827.  
  5828.  
  5829. ΓòÉΓòÉΓòÉ 19.1. Opening Query for OS/2 objects from the command line ΓòÉΓòÉΓòÉ
  5830.  
  5831. To open a QUERY FOR OS/2 object from an OS/2 command line, enter: 
  5832.  
  5833. ftbas3 /cclass_name /nobjectname 
  5834.  
  5835. where: 
  5836.  
  5837. class_name   An object class name from the following list: 
  5838.  
  5839.    IBMTABLE             Visualizer Table object 
  5840.  
  5841.    IBMSQLSTATEMENT      SQL Statement object 
  5842.  
  5843.    IBMQUERY             Visualizer Query object 
  5844.  
  5845.    IBMREPORT            Visualizer Report object 
  5846.  
  5847.    IBMSQLTABLE          SQL Table object 
  5848.  
  5849.    IBMSQLVIEW           SQL View object 
  5850.  
  5851. objetcname   The name of the object to be run, including the path, if 
  5852.              necessary. 
  5853.  
  5854.  
  5855. ΓòÉΓòÉΓòÉ 19.1.1. Running Query for OS/2 objects from the command line ΓòÉΓòÉΓòÉ
  5856.  
  5857. You can run Visualizer queries and SQL Statements from the command line without 
  5858. opening them. To do this, use the following command: 
  5859.  
  5860. ftbas3 /cclass_name /nobjectname /k[run] 
  5861.  
  5862. where: 
  5863.  
  5864. class_name   An object class name: 
  5865.  
  5866.    IBMQUERY             Visualizer Query object 
  5867.  
  5868.    IBMSQLSTATEMENT      SQL Statement object 
  5869.  
  5870. objetcname   The name of the object to be run, including the path, if 
  5871.              necessary. 
  5872. For example: 
  5873.  
  5874. ftbas3 /cIBMQUERY /nmyquery /k[run]
  5875.  
  5876.  
  5877. ΓòÉΓòÉΓòÉ 19.1.2. Running SQL tables and SQL views from the command line ΓòÉΓòÉΓòÉ
  5878.  
  5879. You can open and browse SQL tables and SQL views by using the following 
  5880. command: 
  5881.  
  5882. ftbas3 /cclass_name !qcreatorid.tablename !ddatabase 
  5883.  
  5884. where: 
  5885.  
  5886. class_name   An object class name: 
  5887.  
  5888.    IBMSQLTABLE          SQL Table object 
  5889.  
  5890.    IBMSQLVIEW           SQL View object 
  5891.  
  5892. creatorid    The creator of the table or view. This is optional-you need to 
  5893.              specify this only when you are not the creator of the table or 
  5894.              view. 
  5895.  
  5896. tablename    The name of the table or view to be opened. 
  5897.  
  5898. database     The name of the database the table or view is located in. 
  5899.  
  5900. Note: 
  5901.  
  5902. The ! parameters must come immediately after the / option. 
  5903.  
  5904. QUERY FOR OS/2 automatically picks up the user ID and password specified in the 
  5905. Database Settings window. Therefore, if a database requires a user ID and a 
  5906. password, specify them by using the Database Settings window. 
  5907.  
  5908.  
  5909. ΓòÉΓòÉΓòÉ 19.1.3. Using variable values from the command line ΓòÉΓòÉΓòÉ
  5910.  
  5911. Some QUERY FOR OS/2 objects use variables. These objects are Visualizer Query, 
  5912. Visualizer Report, and SQL Statement. To use variable values with these objects 
  5913. when running them from the command line, enter: 
  5914.  
  5915. ftbas3 /cclass_name /nobjectname /@p1=p1value@p2=p2value 
  5916.  
  5917. where: 
  5918.  
  5919. class_name           An object class name: 
  5920.  
  5921.    IBMQUERY             Visualizer Query object 
  5922.  
  5923.    IBMSQLSTATEMENT      SQL Statement object 
  5924.  
  5925.    IBMREPORT            Visualizer Report object 
  5926.  
  5927. objectname           The name of the object to be run, including the path, if 
  5928.                      necessary. 
  5929.  
  5930. p1, p2, ...          A variable value defined in the object 
  5931.  
  5932. p1value, p2value, ... The value the variable uses when you run the object. 
  5933.  
  5934.  
  5935. ΓòÉΓòÉΓòÉ 19.2. Printing Query for OS/2 objects from the command line ΓòÉΓòÉΓòÉ
  5936.  
  5937. You can print QUERY FOR OS/2 objects to a file or to a printer. 
  5938.  
  5939.  
  5940. ΓòÉΓòÉΓòÉ 19.2.1. Printing Query for OS/2 objects to a file ΓòÉΓòÉΓòÉ
  5941.  
  5942. Printing an object to a file is the same as exporting it. You can print 
  5943. Visualizer tables and Visualizer reports to a file by using the following 
  5944. command: 
  5945.  
  5946. ftbas3 /c.class_name. /n.objectname. "/k[copyto(.filename, format, pwidth, 
  5947. pdepth.)]" 
  5948.  
  5949. where: 
  5950.  
  5951. class_name   An object class name from the following list: 
  5952.  
  5953.    IBMTABLE             Visualizer Table object 
  5954.  
  5955.    IBMREPORT            Visualizer Report object 
  5956.  
  5957. objectname   The name of the object to be printed, including the path, if 
  5958.              necessary. 
  5959.  
  5960. filename     The name of the output file. 
  5961.  
  5962. format       A file format. The following file formats are available for 
  5963.              Visualizer tables: 
  5964.  
  5965.    o DIF 
  5966.    o DBF 
  5967.    o EDIF 
  5968.    o Flat 
  5969.    o IXF 
  5970.    o List 
  5971.    o PCIXF 
  5972.  
  5973.              The following file formats are available for Visualizer reports: 
  5974.  
  5975.    o IBMREPORTRESULTS 
  5976.    o PRINTFILE (a flat ASCII file with page breaks) 
  5977.    o TEXT (a flat ASCII file without page breaks) 
  5978.  
  5979. pwidth       The page width, specified in characters. This value can range from 
  5980.              1 to 254. If this option is not specified, a default value of 80 
  5981.              is used. 
  5982.  
  5983.              This option is only used with TEXT and PRINTFILE formats. 
  5984.  
  5985. pdepth       The page depth, specified in characters. This value can range from 
  5986.              1 to 63999. If this option is not specified, a default value of 70 
  5987.              is used. 
  5988.  
  5989.              This option is only used with TEXT and PRINTFILE formats. 
  5990.  
  5991.  
  5992. ΓòÉΓòÉΓòÉ 19.2.2. Printing Query for OS/2 objects to a printer ΓòÉΓòÉΓòÉ
  5993.  
  5994. You can print the following QUERY FOR OS/2 objects to a printer: 
  5995.  
  5996. o SQL tables 
  5997. o SQL views 
  5998. o Visualizer tables 
  5999. o Visualizer reports 
  6000.  
  6001. To print an object to a printer from the command line, use the following 
  6002. command: 
  6003.  
  6004. ftbas3 /cclass_name /nobjectname "/k[print(printername, dlgoption, method, 
  6005. jobtitle)]" 
  6006.  
  6007. where: 
  6008.  
  6009. class_name   An object class name from the following list: 
  6010.  
  6011.    IBMSQLTABLE          SQL Table object 
  6012.  
  6013.    IBMSQLVIEW           SQL View object 
  6014.  
  6015.    IBMTABLE             Visualizer Table object 
  6016.  
  6017.    IBMREPORT            Visualizer Report object 
  6018.  
  6019. objectname   The name of the object to be printed, including the path, if 
  6020.              necessary. 
  6021.  
  6022. printername  The name of the printer device. 
  6023.  
  6024. dlgoption    Whether the Printer Settings dialogs are displayed. Set this to 1 
  6025.              to display the dialogs, or 0 to suppress them. 
  6026.  
  6027. method       The amount of the object to be printed. 
  6028.  
  6029.    TABLE     Prints the whole table 
  6030.  
  6031.    SUBSET    Prints the subset of the table (if a subset of the table has been 
  6032.              defined and saved). If this option is selected and there is no 
  6033.              subset of the table, the whole table is printed. 
  6034.  
  6035.              This option is only used with the Visualizer Table object. 
  6036.  
  6037. jobtitle     The name of the print job. 
  6038.  
  6039.              This option is only used with the Visualizer Table object. 
  6040.  
  6041.  
  6042. ΓòÉΓòÉΓòÉ 19.3. Creating and starting new Query for OS/2 objects ΓòÉΓòÉΓòÉ
  6043.  
  6044. To create a new QUERY FOR OS/2 object, copy the template for the object to a 
  6045. new location and rename it by entering: 
  6046.  
  6047. copy ftwpath\object_type objectname 
  6048.  
  6049. where: 
  6050.  
  6051. ftwpath      The fully qualified path of your FTW directory. This is the drive 
  6052.              and directory (or directories) where QUERY FOR OS/2 is installed. 
  6053.  
  6054. object_type  The type of object you are creating. This can be: 
  6055.  
  6056.    sql       SQL Statement 
  6057.  
  6058.    query     Visualizer Query 
  6059.  
  6060.    report    Visualizer Report 
  6061.  
  6062. objectname   The full path and name of the new object 
  6063.  
  6064. Open the new object as described in Opening Query for OS/2 objects from the 
  6065. command line. 
  6066.  
  6067.  
  6068. ΓòÉΓòÉΓòÉ 19.4. Working with databases from the command line ΓòÉΓòÉΓòÉ
  6069.  
  6070. To associate an SQL Statement with a database, use !d as the final option of 
  6071. the command: 
  6072.  
  6073. ftbas3 /cibmsqlstatement /nSQLstatement /k[run] !ddatabase 
  6074.  
  6075. where database is the name of the database with which you want to associate the 
  6076. SQL Statement. You can use this option only if the SQL Statement has no 
  6077. currently associated database. 
  6078.  
  6079.  
  6080. ΓòÉΓòÉΓòÉ 19.5. Setting object classes ΓòÉΓòÉΓòÉ
  6081.  
  6082. Some methods used to exchange Visualizer objects with other users may result in 
  6083. the loss of the object's class information. If this happens, the object icon 
  6084. will not be displayed, and the object cannot be opened. 
  6085.  
  6086. You can use the FTBTYPE.CMD REXX command file provided with Visualizer to 
  6087. assign the correct object class to an object. You can also assign a class to 
  6088. Personal AS objects. 
  6089.  
  6090. To apply the correct object class, enter: 
  6091.  
  6092. ftbtype file objectclass 
  6093.  
  6094. where file is the file whose object class is to be restored, and objectclass is 
  6095. the object class that you are applying to the file. 
  6096.  
  6097. Note:   If you apply the incorrect class to an object, or try to apply a class 
  6098. to a file that is not a Visualizer object, a message will be issued when you 
  6099. attempt to open the object. 
  6100.  
  6101. For example, to apply the object class for a chart (IBMQUERY) to a file called 
  6102. MYQUERY located in the C:\USER directory, enter: 
  6103.  
  6104.  
  6105. ftbtype c:\user\myquery IBMQUERY
  6106.  
  6107.  
  6108. ΓòÉΓòÉΓòÉ 20. Common OS/2 tasks ΓòÉΓòÉΓòÉ
  6109.  
  6110. This appendix describes how to create and rename an object. 
  6111.  
  6112.  
  6113. ΓòÉΓòÉΓòÉ 20.1. Creating a new object ΓòÉΓòÉΓòÉ
  6114.  
  6115. You can create a new object from a template or from an existing object. 
  6116.  
  6117.  
  6118. ΓòÉΓòÉΓòÉ 20.1.1. Creating a new object from a Query for OS/2 template ΓòÉΓòÉΓòÉ
  6119.  
  6120. You can create a new object from a template by using drag and drop. Dragging 
  6121. and dropping a template creates a new occurrence of the object that the 
  6122. template represents. The new object is created in the folder where the template 
  6123. is dropped and has the same settings and contents as the template. 
  6124.  
  6125. Use care when working with templates. If you change the settings for a 
  6126. template, any object created from that template has the templates current 
  6127. settings. 
  6128.  
  6129. To create a new object: 
  6130.  
  6131.  1. Open the Visualizer folder. 
  6132.  
  6133.  2. Open the Shadows of Templates folder. 
  6134.  
  6135.  3. Hold down mouse button two and drag a template from the Shadows of 
  6136.     Templates folder to a target folder or to the desktop. 
  6137.  
  6138. If you are creating an SQL table or SQL view, drop the template on a specific 
  6139. SQL database. The SQL table or SQL view will be stored in this SQL database. 
  6140.  
  6141.  
  6142. ΓòÉΓòÉΓòÉ 20.1.2. Creating a new object from an existing object ΓòÉΓòÉΓòÉ
  6143.  
  6144. When you create a new object from an existing object, the new object is created 
  6145. with default settings. 
  6146.  
  6147. To create a new object from an existing object: 
  6148.  
  6149.  1. Display the pop-up menu for an object. 
  6150.  2. Select Create another. A new object with default settings is created. 
  6151.  
  6152.  
  6153. ΓòÉΓòÉΓòÉ 20.1.3. Renaming an object ΓòÉΓòÉΓòÉ
  6154.  
  6155. After you create a new object, you might want to change the name of the object. 
  6156.  
  6157. To rename an object: 
  6158.  
  6159.  1. Hold the Alt key, then select the title of the object you want to change. 
  6160.  
  6161.  2. Type the new name. 
  6162.  
  6163.  3. Use the Backspace key or Delete key to erase the previous name. 
  6164.  
  6165.  4. Move the mouse away from the name and press mouse button one. 
  6166.  
  6167.  
  6168. ΓòÉΓòÉΓòÉ 20.2. Creating a template with a specific definition ΓòÉΓòÉΓòÉ
  6169.  
  6170. You can customize a template and use it to create multiple objects with the 
  6171. same settings. This is useful if you want, for example, all your reports to 
  6172. contain the same heading with a specific font and color. 
  6173.  
  6174. You can create templates with specific definitions for all Visualizer objects. 
  6175.  
  6176. To create a template with a specific definition: 
  6177.  
  6178.  1. Create a new object as described in Creating a new object from a Query for 
  6179.     OS/2 template. If you are working with an SQL Table template or an SQL View 
  6180.     template, do not drop it on an SQL database. Instead, drop it on your 
  6181.     desktop. 
  6182.  
  6183.     An icon for the new object is displayed. 
  6184.  
  6185.  2. Customize the object to include the features you want to use in future 
  6186.     objects. 
  6187.  
  6188.  3. Rename the object as described in Including data in text. 
  6189.  
  6190.  4. Open the notebook for the object to the General page. 
  6191.  
  6192.  5. Select the Template checkbox. The icon on your desktop for the object 
  6193.     changes to a sticky pad with the object icon displayed on it. 
  6194.  
  6195.  6. Close the notebook. 
  6196.  
  6197. To use the template, create a new object from the template. An icon for the new 
  6198. object is displayed. Define the object as outlined in this book for that 
  6199. object. 
  6200.  
  6201.  
  6202. ΓòÉΓòÉΓòÉ 21. Using QMF forms with Query for OS/2 ΓòÉΓòÉΓòÉ
  6203.  
  6204. When you import a QMF form into a Visualizer report, most of the formatting 
  6205. options are converted into the equivalent Visualizer report settings. This 
  6206. appendix lists QMF options that are not converted automatically, but which you 
  6207. can set manually in the report. It also lists QMF options that have no 
  6208. equivalent in a Visualizer report, and are ignored when you import a QMF form 
  6209. containing them. 
  6210.  
  6211.  
  6212. ΓòÉΓòÉΓòÉ 21.1. QMF options with equivalent Visualizer report settings ΓòÉΓòÉΓòÉ
  6213.  
  6214. The following QMF formatting options have equivalent settings in a Visualizer 
  6215. report, but they must be set up manually using the appropriate report settings 
  6216. windows after the form has been imported: 
  6217.  
  6218. o Calculated columns 
  6219.  
  6220. o Fixed columns that do not scroll horizontally 
  6221.  
  6222. o Detail blocks that are conditionally formatted 
  6223.  
  6224. o The number of blank lines appearing before final text 
  6225.  
  6226. o The option of restarting page numbers at the highest break level 
  6227.  
  6228. o Descriptive words, such as SUM and COUNT, that are added to column headings 
  6229.   when the data is grouped 
  6230.  
  6231. o Columns ordered across the report based on GROUP and aggregation usage codes 
  6232.  
  6233. o The choice of time separator character 
  6234.  
  6235. See the appropriate section in Analyzing and presenting data using reports for 
  6236. information on how to change these settings. 
  6237.  
  6238.  
  6239. ΓòÉΓòÉΓòÉ 21.2. QMF options with no equivalent Visualizer report settings ΓòÉΓòÉΓòÉ
  6240.  
  6241. The following QMF formatting options either exceed the limits of the equivalent 
  6242. Visualizer report settings, or have no equivalent in a Visualizer report: 
  6243.  
  6244. o A break column that has a break level greater than 5 
  6245.  
  6246. o Two or more columns with the same break level 
  6247.  
  6248. o Asterisks used as default break text 
  6249.  
  6250. o The FIRST and LAST usage codes 
  6251.  
  6252. o The TCPCT (cumulative percentage of total) usage code 
  6253.  
  6254. o The CSUM (cumulative sum) usage code 
  6255.  
  6256. o Column values that have been substituted with the results of the PCT, CPCT 
  6257.   and TPCT usage codes 
  6258.  
  6259. o Column values formatted in hexadecimal, binary or scientific notation 
  6260.  
  6261. o Column values formatted in decimal notation with leading zeros or a percent 
  6262.   symbol 
  6263.  
  6264. o Locally defined date and time formats 
  6265.  
  6266. o The variables &ROW, &COUNT, &CALCn and &an 
  6267.  
  6268. o Non-displayed summary columns created by aggregation usage codes in across 
  6269.   reports 
  6270.  
  6271. o Column widths greater than 254 characters 
  6272.  
  6273. o Wrapping of column values onto a new line, including smart wrapping on 
  6274.   specified characters 
  6275.  
  6276. o Wrapping of text onto a new line when the report width is exceeded 
  6277.  
  6278. o Detail heading text and detail block text displayed on each detail line 
  6279.  
  6280. o Detail blocks that, when printed, each appear on a new page 
  6281.  
  6282. o Final report text (such as END OF REPORT ) that appears on a new page 
  6283.  
  6284. You can import a QMF form that uses these formatting options, but they will not 
  6285. appear in the resulting Visualizer report. 
  6286.  
  6287.  
  6288. ΓòÉΓòÉΓòÉ 22. Bibliography ΓòÉΓòÉΓòÉ
  6289.  
  6290. The following lists do not include all the books for a particular library. To 
  6291. order copies of the books listed here, or to get more information about a 
  6292. particular library, see your IBM representative. 
  6293.  
  6294. IBM DATABASE 2 OS/2 (DB2/2) Version 1 Release 1 
  6295.  
  6296.    IBM DATABASE 2 OS/2 SQL Reference, S62G-3667 
  6297.  
  6298. IBM DATABASE 2 Client Application Enabler/2 (CAE/2) Version 1 Release 1 
  6299.  
  6300.    IBM DATABASE 2 Client Application Enabler/2 User's Guide, SC09-1627 
  6301.  
  6302. IBM Operating System/400* Version 2 
  6303.  
  6304.    Application System/400* Systems Application Architecture* SQL/400 Reference, 
  6305.    SC41-9608 
  6306.  
  6307. IBM DATABASE 2 AIX* (DB2/6000) Version 1 Release 1 
  6308.  
  6309.    DATABASE AIX/6000* and DATABASE OS/2 SQL Reference, SC09-1574 
  6310.  
  6311. SQL/Data System (SQL/DS) for VM (Version 3 Release 3) and VSE (Version 3 
  6312. Release 4) 
  6313.  
  6314.    SQL/DS: SQL Reference for IBM VM Systems and VSE, SH09-8087 
  6315.  
  6316. IBM DATABASE 2 Version 2 Release 3 
  6317.  
  6318.    IBM DATABASE 2 SQL Reference, SC26-4380 
  6319.  
  6320.  
  6321. ΓòÉΓòÉΓòÉ 23. Visualizer Education Request Form ΓòÉΓòÉΓòÉ
  6322.  
  6323. To receive details on Visualizer Education, please complete this form and mail 
  6324. or fax it to: 
  6325.  
  6326. IBM United Kingdom Limited
  6327. ContactPoint
  6328. Warwick Software Development Laboratory
  6329. PO Box 31, Birmingham Road
  6330. WARWICK
  6331. United Kingdom  CV34 5JL
  6332.  
  6333. Telephone:                    +44 926 464845 
  6334. Fax number:                   +44 926 410764 
  6335. IBM Mail Exchange:            GBIBMNRT at IBMMAIL 
  6336. IBM Internal Network:         MARKET at ASICVM1 
  6337. Bitnet:                       MARKET at VNET 
  6338. Internet:                     market@asicvm1.vnet.ibm.com 
  6339.  
  6340. IBM Corporation
  6341. FAO Mary Crocket
  6342. 1 East Kirkwood Blvd
  6343. Roanoke
  6344. Texas  762 99 0001
  6345. USA
  6346.  
  6347. Telephone:                    +1 817 962 6441 
  6348. Fax number:                   +1 817 962 6005 
  6349. IBM Mail Exchange:            USIB5Z9J at IBMMAIL 
  6350. IBM Internal Network:         JONESSH at MSNVM1 
  6351. Internet:                     jonessh@msnvm1.vnet.ibm.com 
  6352.  
  6353. Query for OS/2                          Procedures for OS/2 
  6354.  
  6355. []  Introductory education              []  Introductory education 
  6356. []  Advanced education                  []  Advanced education 
  6357.  
  6358. Charts for OS/2                         Development for OS/2 
  6359.  
  6360. []  Introductory education              []  Introductory education 
  6361. []  Advanced education                  []  Advanced education 
  6362.  
  6363. Statistics OS/2                         Plans for OS/2 
  6364.  
  6365. []  End-user education                  []  End-user education 
  6366.  
  6367. Other (Please detail your requirements) 
  6368.  
  6369. ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇ
  6370. ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇ
  6371. ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇ
  6372.  
  6373. Name:                Address:
  6374.  
  6375. Company:
  6376.  
  6377. Phone No.:
  6378.  
  6379.  
  6380. ΓòÉΓòÉΓòÉ 24. Visualizer Information Request Form ΓòÉΓòÉΓòÉ
  6381.  
  6382. To receive information about Visualizer products, just call: 
  6383.  
  6384. In U.S.A., 1-800-IBM-CALL, extension 137 
  6385.  
  6386. In Canada, 1-800-465-1234, extension 2002 
  6387.  
  6388. Elsewhere, +44 926 464845 
  6389.  
  6390. Alternatively, complete this form and fax it to: 
  6391.  
  6392. +44 926 499256 
  6393.  
  6394. []  Query for OS/2                 []  Procedures for OS/2 
  6395. []  Charts for OS/2                []  Development for OS/2 
  6396. []  Statistics for OS/2            []  Plans for OS/2 
  6397. []  Ultimedia Query for OS/2 
  6398.  
  6399. Other (Please detail your requirements) 
  6400.  
  6401. ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇ
  6402. ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇ
  6403. ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇ
  6404.  
  6405. Name:                Address:
  6406.  
  6407. Company:
  6408.  
  6409. Phone No.:
  6410.