- 28

- Client Application Generation

- Generating Screens and Reports

- Creating a Module Data Diagram

- Selecting the Module
- Summary Information
- Table Usages
- Relationships Between Tables
- Column Usages
- Editing Columns on a Screen
- Editing Columns on a Report
- Saving Your Diagram
- Placing Screen Items on Different Windows or Canvases
- Placing Report Items on Different Pages
- Consolidating

- Making a Diagram Easier to Follow

- Using Colors, Fonts, and Line Width

- Working with Large Diagrams

- Using Navigate
- Using Minimize Number of Pages
- Zooming In and Out

- Generating

- Options When Generating the Screen
- Options When Generating the Report

- Summary

#
28

## Client Application Generation

Client application generation is the creation of screens and reports. You perform client application generation during the design and build phases of the life cycle of an Oracle project. In this chapter, you will learn the Module Data Diagrammer tool, which is used to generate both screens and reports. On the top of the screen are a pull-down menu and a toolbar of icons. All of the functions that these icons perform can also be found on the menu bar under Edit, View, Utilities, and Tools. Whether you want to use the icons or the menu is just a matter of usage style. For the most part, the descriptions in this chapter use the icons rather than the menu bar.

Start the Module Data Diagrammer by clicking its icon and entering your user ID, password, and CASE application. Across the top of the screen, you will see a set of icons used to design a diagram (see Figure 28.1).

Figure 28.1. The Module Data Diagrammer.

Initially, you can create a new diagram by either choosing New from the File menu or pressing the New Diagram icon (refer to Figure 28.1). When you choose this icon, or any icon from the Designer/2000 toolset, help is always available. You can see the help message appear in a balloon to the right of the icon when you move your cursor to an icon without pressing the mouse button. You can also get help by pressing the Context Help icon and then selecting anything on your screen (either an icon or an element). Finally, you can search for help on any topic from the Help menu pick.

### Generating Screens and Reports

You can use the Module Data Diagrammer to generate screens and reports from Designer/2000. The module basis can come from a number of sources:

- A function that generated a module when you used the Module Design Wizard
- A module that is created in the Repository Object Navigator (RON)
- A module that is created in the Module Data Diagrammer

#### Creating a Module Data Diagram

To create a module data diagram you need to take certain steps. You must create or select the module, add or modify the summary information, select the data usages, and generate the screen or report.

##### Selecting the Module

To select a module, select the Create Module icon. At this point, a list of module names appears. Select Report if you are creating a report or Screen if you are creating a screen and then select the module name from the list. If you are creating the module for the first time, click the Create Module button. Now fill in the module short name, description, language, and module type.

Designer/2000 generates only the new reporting tool ORACLE Reports and not SQL*Reportwriter. You can choose SQL*Reportwriter if you are in fact writing your reports with this tool, but they will not be generated from Designer/2000.
Designer/2000 generates only the new screen painting tool ORACLE Forms and not SQL*Forms. You can choose SQL*Forms if you are in fact writing your reports with this tool, but they will not be generated from Designer/2000.

##### Summary Information

Initially, when you start your diagram you might want to fill in the summary information so that you can easily identify the diagram when it is printed. Under the File menu is a pick called Summary Information (see Figure 28.2). A window will pop up showing you all the choices you have for information to be included on your chart.

Figure 28.2. The module data diagram summary information.

Select any information you want to display on the diagram. If you want your name or a diagram title, you need to fill in these items.

##### Table Usages

If you selected an already existing module that contains table usages, they will appear in a data diagrammer format. Parent/child relationships will display with the parent table on the top and the child on the bottom. Lookup relationships will display with the lookup to the right of the base table.

If you are creating a new module or need to add new table usages to your module you need to select the Table icon (refer to Figure 28.1). Click the icon and select a table from the list of values.

If you want to include more than one table without having to select the button each time, hold down the Shift key when you select the table button. When you are ready to move on to another activity, press another button on the icon bar.

After you have added a table to the diagram you can edit its usage.

###### Editing Table Usage for a Screen

To edit table usage for a screen, double-click the item, and you can edit Table Details, Table Layout, and Table Text.

Under the Table Details tab (see Figure 28.3), you can edit the allowable actions that are on-screen: insert, update, delete, query. These usages are the default for the entire table. Next, you can change the alias, block title, and comment. These will default from what was entered in the table definition.

Figure 28.3. The Table Details tab for a screen.

In the Table Layout tab (see Figure 28.4), you can select the number of rows to be displayed, the overflow style (whether the window should scroll, if only the field will scroll, or if the field will truncate), and the measurements of the canvas and window.

Figure 28.4. The Table Layout tab for a screen.

In the Table Text tab (see Figure 28.5) you can type in any WHERE clause, any notes, and any help text that you want for online help on the screen you are designing. The WHERE clause can trim down the selection from the table based on some rule defined for the module being generated.

Figure 28.5. The Table Text tab for a screen.

###### Editing Table Usage for a Report

To edit table usage for a report, double-click the item. Under the Table Details tab (see Figure 28.6), you can edit the title and alias to be displayed, add comments, and choose the layout style. You can also choose the maximum number of records that can appear on a page.

Figure 28.6. The Table Details tab for a report.

Under the Table Text tab (see Figure 28.7), you can put in any additional notes and any WHERE clause. The WHERE clause can trim down the selection from the table based on some rule for the module being generated.

Figure 28.7. The Table Text tab for a report.

Wait to edit table usage until after you have added column usage. That way you only have to go into the edit screen once.

##### Relationships Between Tables

After you have added more than one table to a diagram you will want to display the relationships between the tables. Usually, when you add the second table in a relationship, the diagrammer will automatically add the relationship. Sometimes it does not. To add the relationship, select the Relationship icon (refer to Figure 28.1). Next, select one of the tables in the relationship, and then the other table in the relationship. The diagrammer will automatically place the relationship on the diagram.

Sometimes the diagrammer will not accept the relationship as valid, even though the foreign key does exist in the table definition. The best way to handle this problem is to use Tools | Data Diagrammer off the menu bar. From the Data Diagrammer, find the table with which you are working and look at the foreign keys. Look up the foreign key you are trying to link to make sure it is valid. Now exit the diagrammer. Try to create the relationship again. If it still does not work, delete the lookup table from the diagram and try to add it again. If you cannot get the relationship to display, call Oracle Support.

##### Column Usages

If you select an already existing module that contains column usages, they will appear in a data diagrammer format. If you are creating a new module or need to add new column usages to your module, you need to select the table to which you are adding column usages. Then select the Column icon (refer to Figure 28.1). Click the icon and select a column from the list of values.

If you want to include more than one column without having to select the button each time, hold down the Ctrl key when you select the column button. If you want to select a set of columns, use the Shift key. If you want to select all the columns press the Select All button.
On a table with many columns where you want to keep most, but not all of the columns, it is easier to press the Select All button, and then deselect the columns you do not want by pressing the Ctrl key at the same time you select the unwanted column.

The columns will appear on your screen or report in the order they display on the table box. To change the order of columns, simply select the one to be moved and drag it up or down to the position in which you want it to be.

After you have added the column usages you can edit them. Double-click the table or any of the columns listed. Double-clicking the table will bring up the edit window at the Table Details tab. Double-clicking the column will bring up the edit window at the Column Details tab, displaying the selected column.

##### Editing Columns on a Screen

Different tabs are available for modifying the look and feel of columns on a screen on the Detail Usages For A Screen dialog box: Usage, Column Details, Column Display, and Column Text.

###### Editing Usages

The Usages tab enables you to view and modify the usage of a column while you look at the usages of all the columns on the screen. (See Figure 28.8.)

Figure 28.8. The column Usage tab for a screen.

If you enter a usage that is not available for the table usage, the form will ignore the column usage. For example, if the employee table does not allow insert in your module, any insert usage on a column will be ignored when you run the Oracle Form that the module generator creates.

###### Editing Column Detail

The Column Detail tab enables you to edit usage, sort order, summary information, and hints. (See Figure 28.9.)

Figure 28.9. The Column Detail tab for a screen.

The Usage area is the same as the Usage tab; however, you can see only one column of the screen at a time.

Order By refers to how the information is ordered in the selection from the database. For example, if you place a 1 in this box for the ID column, the data will order by the ID column. In the lower drop-down list you can select in which direction the information is ordered—either ascending or descending.

In the Summaries box you list what type of summary calculation you want on a column. The Function box is a pop-up list of function types—sum or count. Type is a pop-up list of where you would want the break to be—the group. Source is a pop-up list of the columns available on the table; choose the one to be summarized.

To select both the detail and summary of a column, select the column twice. In the second selection, fill in the summary information. Do the same thing to create a calculated field.

The hint area is where you enter the hint for the user. When the screen is generated, this hint appears when the user enters the field on the screen. You can also enter a default value for the column at this point.

###### Editing the Column Display

The Column Display tab describes how columns will be displayed on the screen. (See Figure 28.10.)

Figure 28.10. The Column Display tab for a screen.

The display box contains the prompt that will appear on the screen. You can set the justification of the column—right, left, and so on—from the Justification pop-up list. You select the data type of the column—character, numeric, and so on—from the Display Datatype pop-up list. In the Display Format box you can enter a format mask. You enter the implementation item—whether the item is OLE or VBX—in the Implementation Item box. The width and height requirements can be entered for the column.

If you make the width of the column the same as the width of the field, the generated box for the field will not be wide enough to fit a value that is as wide as the maximum width. Add an additional two characters to the width of a field; it will not scroll off the screen.

If you enter three or four column heights, the screen will not generate. It will look as if it continues to process, but the screen will never return from generation.

The Item Group box in the Column Display tab contains the name of the item group. If you want to display blocks of columns together, enter a name in the Item Group box. Then enter the prompt for the item group. The next time you want to add a column to this group, select the name from the Item Group pop-up list.

###### Editing Column Text

The Column Text tab (see Figure 28.11) contains any notes you might want to have on the column, any derivation expressions or formulas for extracting the columns, any PL/SQL needed to derive the column, any user text you might want to supply online, and any conditions for highlighting (a negative number, a yes answer to a question, any date beyond 90 days from the current date, and so on).

Figure 28.11. The Column Text tab for a screen.

##### Editing Columns on a Report

Different tabs are available for modifying the look and feel of columns on a report on the Detail Usages For A Screen dialog box: Column Details, Column Display, and Column Text.

###### Editing Column Details

The Column Detail tab enables you to edit order by, argument, and summary information (see Figure 28.12).

Figure 28.12. The Column Detail tab for a report.

Alias refers to a nickname you want to give the column. This action is useful if it is a user-defined, summary, or duplicate selection. If you do not define an alias, the report generator might bomb out because it is trying to create a SQL query with two references to a table with the same name. Click the Display box if the column contents will be displayed on the report.

Order By refers to how the information is ordered in the selection from the database. For example if you place a 1 in this box, the data will order by this column first. In the lower drop-down list you can select the direction for the sort order: ascending or descending.

Argument refers to any paring down you might want to do in the selection of the column. The Operator drop-down list is a list of argument types: =, >, like, and so on. You enter the comparison value in the Name box.

In the Summaries box, you would list the type of summary calculation you want on a column. The Function box is a drop-down list of function types, such as sum, standard deviation, and so on. Type is a pop-up list of where you would want the break to be, such as in the item, the page, or the report. Source is a pop-up list of the columns available on the table; choose the one to be summarized.

To select both the detail and summary of a column, select Column Usage twice. The second time you select it, fill in the summary information. Repeat this step to create a calculated field.

###### Editing the Column Display for a Report

If you select the Column Display tab (see Figure 28.13), you can edit the display and grouping characteristics. These will default from whatever was entered in the attribute definition and generated as a column, or whatever was added or edited in the column definition.

Figure 28.13. The Column Display tab for a report.

The Display box contains the prompt that will appear on the header of each breakpoint. In the Justification drop-down list, set the justification of the column—right, left, and so on. Select the data type of the columns—character, numeric, and so on—from the Display Datatype drop-down list. Select whether the column should be cut off or wrap on a page by selecting the option from the Wrap drop-down list. Finally, in the Width and Height boxes, select the width and height requirements for the column.

If you enter too many varying column heights, the report will not generate. It will look as if it continues to process, but the tool will never return from generation.

The Item Group box contains the name of the item group. If you want to display blocks of columns together, enter a name in the Item Group box. Then, enter the prompt for the item group. The next time you want to add a column to this group, select the name from the Item Group Name drop-down list.

###### Editing Column Text

The Column Text tab (see Figure 28.14) contains any notes you might want to include on the column, any derivation expressions or formulas for extracting the columns, and any conditions for highlighting (a negative number, a yes answer to a question, any date beyond 90 days from the current date, and so on.)

Figure 28.14. The Column Text tab for a report.

##### Saving Your Diagram

When you are ready to save the diagram select File | Save from the menu bar. You can also save your work by pressing the Save icon (refer to Figure 28.1). At this point you can name your diagram.

It is important to save often. The Oracle Client/Server tools use a large amount of memory and can sometimes cause a general protection fault on the PC. Saving often decreases the risk of losing any unsaved work.

##### Placing Screen Items on Different Windows or Canvases

Sometimes you will want some of your data to display on a different window or canvas than other data. For example, you might have employee personal information on one window and their address on the next window. To move an item to a different window, select the New Window icon (refer to Figure 28.1). Place the cursor on the diagram and a new window will appear. You can add tables to this window or move existing tables from one window to another.

You might also want to place a table, such as a lookup table, on a pop-up list. To add a pop-up list, select the Pop List icon (refer to Figure 28.1). Drag the cursor around the base table and the lookup that will be the pop-up.

##### Placing Report Items on Different Pages

Sometimes you will want some of your data to print on a different page than other data. For example, you might want to print summary information first, and then detail information. To move an item to a different page, select the New Page/Report icon (refer to Figure 28.1). Place the cursor on the diagram and a new page will appear. You can add tables to this page or move existing tables from one page to another.

##### Consolidating

You can make changes to a table or its relationships in either the Data Diagrammer or RON. The changes will not be reflected on any module data diagrams that use the same tables. There might be a reason for the user to keep the changes off—to reflect an earlier point in time or reflect the business opinions of another department. However, it is possible to take into account the changes from other users and consolidate them into the current diagram. To do so, you must choose Edit | Consolidate from the menu bar. At this point, you can choose whether to consolidate a specific entity, relationship, or the entire diagram.

If new tables were added to a module definition in RON they will not be on the diagram. To add these tables or relationships to the diagram, select Edit | Include New. Any new tables or relationships will be added to the diagram.

If you do not consolidate an element that has changed, you cannot edit the module.

#### Making a Diagram Easier to Follow

There are several ways in which you can make the diagram easier for the customer to follow, as explained in the following sections.

##### Using Colors, Fonts, and Line Width

You can change the colors of tables and relationships, the fonts of words, and the line width of table outlines and relationships. By changing these items you can make the diagram more readable and more intelligent. For example, you can fill in with blue all lookup tables. The diagrammer has default colors set up for the base table, lookup table, page, and so on. You change the defaults under Edit | Preferences off the menu bar.

The colors on the diagram will show up only if you have a color printer. However, if you are using a black-and-white printer, colors will show up grayed, so you can use one color differentiation.

You can change the entire diagram or just a specific entity, relationship, or combination. To change the entire diagram choose Edit | Select all off the menu bar. To select one or more entities or relationships, select one and hold down the Ctrl key until all the items are selected.

To change the line width, select the Line Width icon (refer to Figure 28.1). Choose a line width from the items listed. To change the line color, choose the Line Color icon. Choose a line color from the colors listed. To change the fill color of entities, choose the Fill Color icon. Choose a color from the items listed. To change the font of any text selected, choose the Text icon. You can change the font, the style of the font, and the size of text.

#### Working with Large Diagrams

When you work with large diagrams, keeping track of where you are on the diagram can become difficult, and the diagram can take up many pages when it prints. There are simple ways to deal with these irritations.

##### Using Navigate

To move from table to table on the diagram, use Edit | Navigate on the menu bar and then select a table. The cursor will select the table you request, and the focus of the screen will include the table requested.

##### Using Minimize Number of Pages

Often, when the diagram is filled with many entities, it becomes very large, sprawling horizontally or vertically. As a result, many blank pages can fill the borders of the diagram. You can reposition the diagram to use the least amount of pages by using the Minimize Number of Pages icon. Pressing this icon will reposition the entire diagram so that the least number of pages are used.

##### Zooming In and Out

You can zoom in and out of your picture to get a better idea of how an area of the picture looks or how the entire picture looks. The magnifying glass icons enable you to perform this function. Use the Normal Size icon to return to normal size. To enlarge, use the Enlarge icon. To shrink, use the Shrink icon.

#### Generating

When you are satisfied that your diagram represents what you want your report or screen to do, you can go ahead and generate it. First, make sure you save the diagram. Second, make sure that the tables your module uses are already generated on your database. To generate tables right from the Module Data Diagrammer, press the Generate DDL icon (refer to Figure 28.1). Refer to Chapter 29, "Server Generation," on how to Generate DDL. To generate the module, press the Generate icon. The Generate Form screen will appear (see Figure 28.15).

Figure 28.15. The Generate tab in the Generate Form screen.

The screen defaults to the current module to be generated, but you can change any of the objects to generate a different module.

##### Options When Generating the Screen

You can set many options when you generate a screen. The following tabs are available: Form Option, Menu Option, Compile, Run, Template, and Other.

The Form Option tab (see Figure 28.16) enables the user to select where the generated form will be located and how it will be generated.

Figure 28.16. The Form Option tab in the Generate Form dialog box.

The Menu Option tab looks the same as the Form Option tab. It shows the location of the menu that needs to be generated to attach to the form, if the default menu will not be used.

The Compile tab (see Figure 28.17) lets you specify if and where compiled forms will be generated. You can choose not to generate executable code or to put it in a different place than the compiled code.

Figure 28.17. The Compile tab in the Generate Form dialog box.

The Run tab (see Figure 28.18) enables you to select whether the form should be run after it is generated and the commands to run the form.

Figure 28.18. The Run tab in the Generate Form dialog box.

The Template tab enables you to enter a template form and a menu template for generating the form (see Figure 28.19).

Figure 28.19. The Template tab in the Generate Form dialog box.

The Other tab enables you to enter any log you want to keep, any library being used, and any default terminal information needed to run the screen (see Figure 28.20).

Figure 28.20. The Other tab in the Generate Form dialog box.

##### Options When Generating the Report

The Report Options tab in the Generate Report dialog box, in which you generate report modules, lists the options you have for generating a report. (See Figure 28.21.)

Figure 28.21. The Report Options tab.

You can change and save any of the options in this tab as the default.

When you are ready to generate the report, press the Start key. As the tool generates, the cursor will turn into turning gears.

If you have the minimal amount of memory, the gears will not turn.

If the generator has any question on any data you entered, it will prompt you. For example, if you did not fill in the maximum number of lines on a screen or page, the generator will suggest a default, and you will be given the opportunity to overwrite it.

If anything seems suspicious to the generator, such as a column length that displays longer than the column itself, the generator will list a warning message.

If anything will make generation impossible, the generator will list an error message and the generation will terminate. One example might be if a table that is used in your module definition does not exist.

If you want to stop generating at any time, just press the Stop button.

When the generation is complete, the application will run or prompt you, depending on which run option you chose.

### Summary

Application generation is the generation of screens and reports using the Module Data Diagrammer and Module Generator. Using the Module Data Diagrammer, you can set up the look and feel of your screen or report. When you are satisfied with your module definition, you can go ahead and generate your screen or report. Your screen or report will be well documented in the module definition and created to the exact specifications defined in the Module Data Diagrammer.