Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

86
1 Jerry Post Copyright © 2003 Database Management Database Management Systems Systems Chapter 6 Forms and Reports
  • date post

    22-Dec-2015
  • Category

    Documents

  • view

    218
  • download

    1

Transcript of Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

Page 1: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

1

Jerry PostCopyright © 2003

Database Management Database Management SystemsSystems

Chapter 6

Forms and Reports

Page 2: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

2

DDAATTAABBAASSEE

Uses of Forms

Collect Data Display Query Results Display Analysis and Computations Switchboard for other Forms and Reports Direct Manipulation of Objects

GraphicsDrag and Drop

Page 3: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

3

DDAATTAABBAASSEE

Human Factors Design User Control

Match user tasks. Application responds to user

control & events. User customization

Consistency Layout, Design & colors Actions

Clarity Organization Purpose Terminology

Aesthetics Art to enhance, graphics Sound

Feedback Methods

Visual Text Audio

Uses Acceptance of input Changes to data Completion of tasks Events / Activation

Forgiveness Anticipation and correction

of errors Confirmation on delete and

updates Backup and recovery

Page 4: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

4

DDAATTAABBAASSEE

Windows Interface Standards

The Windows Interface: An Application Design Guide (Microsoft)

Navigation and Choices Mouse, Icons Keyboard, Short-cuts Menus

Selections from a list Single Contiguous Multiple Disjoint Multiple

Focus Outline box Cursor

Manipulation Activation Drag and Drop

Feedback Progress indicators and

status gauges Flashing Tool tips Status bar 3-D controls Message boxes

Page 5: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

5

DDAATTAABBAASSEE

Windows Interface

Window componentsFrame (sizing)Title barControl-menu boxButtons

MinimizeMaximizeCloseScroll box (thumb)Scroll bar

Page 6: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

6

DDAATTAABBAASSEE

Windows Menus

MenusDrop-down

Short Cut KeysMnemonic character

Pop-up (as needed)

Page 7: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

7

DDAATTAABBAASSEE

Message Box (A Simple Form)

Message Boxes Title Message Simple buttons Icons Modal (required)

Page 8: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

8

DDAATTAABBAASSEE

Interface / Accessibility

Multiple Input MethodsKeyboardMouseVoice

Multiple OutputVisualSoundColor

Some Suggestions:Beware of Red/Green.Avoid requiring rapid

user responses.Avoid rapid flashing on

the screen.Give users customization

options.VolumeColorTypefaces & Fonts

Page 9: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

9

DDAATTAABBAASSEE

Form Layout

Types of Forms Tabular Single Row Sub-forms (one-to-many) Switchboard

Controls Form Properties Form Events

Form

Order

11 Dog 5 7 Dog 113 Cat 2

Items

Page 10: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

10

DDAATTAABBAASSEE

Tabular Form

Works best for single table. Designer can control data

entry sequence. Probably include buttons for

sorting.

Page 11: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

11

DDAATTAABBAASSEE

Single Row (Columnar) Form

Data for only one row. Designer can set optimal

layout. Similar in appearance to

paper forms. Can use color, graphics, and

command buttons to make the form easier to use.

Note the importance of the navigation buttons.

Probably want a Find command.

Useful to include subforms.

Page 12: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

12

DDAATTAABBAASSEE

Sub-Forms Typically a one-to-many relationship. Subform contents are linked to the main form through a common

column (not displayed on the subform.) Can have multiple subforms (Independent or Nested).

Page 13: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

13

DDAATTAABBAASSEE

Switchboard Form

Blank Form Graphics/Picture/

Background Identify User Choose Task.

Page 14: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

14

DDAATTAABBAASSEE

Menu Design

1. Setup Choices

2. Data Input

3. Print Reports

4. DOS Utilities

5. Backups

Daily Sales Reports

Friday Sales Meeting

Monthly Customer Letters

Exit

Main Menu Customer Information

Hard to understand Organized by user tasks.

Page 15: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

15

DDAATTAABBAASSEE

Menus

Consistency With operating environment Within project

Pull-down Name, Action Shortcut keys Access keys (&File, File) Breaks/groups (-) Dimmed option Check mark

Submenus () Logical groupings Tradeoff: length v depth

Form indicator (…)

Pop-up Miniature form Tied to location/pointer Right-mouse button Attribute settings Modal (keeps focus) or not

Page 16: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

16

DDAATTAABBAASSEE

Queries

Queries are used to automatically look up data. e.g., Customer name e.g., Product description

Be very careful when using queries. Each form should store data

in only one table. For multiple tables, use a

subform or separate forms. Usually Lock the look up

data so it cannot be changed accidentally.

Page 17: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

17

DDAATTAABBAASSEE

Form Query Example Clerk enters a CustomerID.

Stored in the Order table.

Query joins Sale and Customer. Automatically matches the

CustomerID. Matching name is displayed

on the form. Do not include the join column

(CustomerID) from the look up table (Customer).

Customer Order

1234SaleID17CustomerID

7/25/01Date

Carly Embry

Page 18: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

18

DDAATTAABBAASSEE

Form Query: Underlying Tables

Customer Order

1234SaleID17CustomerID

7/25/01Date

Carly Embry

SaleID CustomerID Sdate1232 23 7/24/011233 74 7/24/011234 17 7/25/01

CustomerID First Last15 Connie Fisher16 Rosie Wade17 Carly Embry

Sale Customer

QueryJoin

Dataentry Data

display

Page 19: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

19

DDAATTAABBAASSEE

Form Properties (Some)

Data Base Table / Query Filters Sort

Integrity Edits Additions, Deletions Locks

Other Pop-up menus Menu Bar Help

Format Caption Scroll Bars Record Selectors Navigation Buttons Size and Centering Background/Pictures Colors Tab Order

Page 20: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

20

DDAATTAABBAASSEE

Controls on Forms (Basic)

Last Name

Country

Credit CardCheckCash

Payment Method Options

Gift wrapGift cardMonogram

x

Sales

Label Text box

Option button Check box Command button

Drop down list or combo box

ClothingShoesElectronics

x

List box

Page 21: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

21

DDAATTAABBAASSEE

Pictures

Background pictures Unbound, unchanging. Stored with the form. Keep edit screen readable. Sizing (zoom, scale, clip).

Pictures stored as data Bound to a data column. Define column as object. Tie to scanner or graphics

package through OLE. Beware of data size

Resolution Number of colors

User machine capabilities.

Employee

Name: Che Zhang

ID: 3354

Phone: 222-111-1524

. . .

Photo:

Page 22: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

22

DDAATTAABBAASSEE

Basic ControlsLabel

Text BoxOption Group(single response)

Combo Box(click arrow to open)

List Box(always open)

CommandButton

Page 23: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

23

DDAATTAABBAASSEE

Combo & List Boxes User selects from a list Combo box can enter new

data, or restrict to list. Two basic uses:

Insert a value into a table Choose from a list of preset

options, e.g. gender. Select from a different

table, e.g., choose a customer.

Find the data record in this form that matches the choice.

Be careful! Many systems do not distinguish between the two uses (enter data and search).

Example when you want to use data entry: On a sales form, use a

combo box for customer. It takes a value from the

Customer table and inserts the ID into the Sale table.

Example when you want to use a search: On a Customer edit form,

you might use a combo to search the Customer table.

Be sure the combo is not bound to the table!

Probably need to write code for search.

Page 24: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

24

DDAATTAABBAASSEE

Combo Box

ControlSource sets the column to receive the choice (in the Sale table)

RowSource generates the list of data to display. Uses standard SQL. Note 4 columns displayed. First column is the one to

store in the data table.

Name CustomerIDControlSource CustomerIDFormatDecimalPlaces AutoInputMaskRowSource/Type Table/QueryRowSource SELECT . . .ColumnCount 4ColumnHeads NoColumnWidths . . .BoundColumn 1

Properties

SELECT Customer.CustomerID, Customer.LastName, Customer.FirstName, Customer.Phone FROM Customer ORDER BY Customer.LastName;

Page 25: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

25

DDAATTAABBAASSEE

Combo Box Sources Microsoft Access supports

three methods: Fixed list. Query from a table. Defined function.

With some systems (e.g., Visual Basic), you write code to generate each list entry.

You might use a fixed list for simple lists like “male”, “female”, “unknown”.

It is better to query from a table, even for simple lists. Use a one column table. Easier to add to a table than

to change a combo box.

Useful feature of list combo box. The Row Source property is

a text string. This string can be

generated by code. List entries can be changed

in response to user actions.

Programmed function. For straightforward cases, it

is easier to use a fixed list and just change the text.

More complex cases, you can write a subroutine that generates the list choices following a specific format.

Page 26: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

26

DDAATTAABBAASSEE

Controls on Forms (Complex)

Common Tab Grid Calendar Gauge Slider Spin Box

Additional Purchase Create your own (C++)

Tab

Grid

Gauge Slider Spin box

Calendar

Page 27: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

27

DDAATTAABBAASSEE

Charts

Build a query that generates the data to be graphed. Numeric data

Individual series Aggregate data

Labels Columns to link to form. Summary chart--unlinked.

Insert chart. Set chart type. Set up data and labels. Set chart properties. Verify size.

Sale 1

Sale 2

Sale 3

Merchandise

Merchandise

Merchandise

Animal

Animal

Animal

Total SalesMerchandise

Animals

Page 28: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

28

DDAATTAABBAASSEE

Multiple Forms

Sale

CustomerFirstName: MaryLastName: JonesAddress: 123 Oaxaca Ave.

Animals Purchased

Merchandise

EditCustomer

FirstName: Mary

LastName: Jones

Address: 123 Oaxaca Ave.

City: Los Angeles

ZipCode: 90086

Gender: Female

Age: 20

AccountBalance: $150

Page 29: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

29

DDAATTAABBAASSEE

Multiple Forms

Using data on other forms The forms object collection Forms![FormName]![Control]

Subtotals and subforms The form property Forms![MainForm]!

[SubForm].Form![Control]

Multi-page v Separate forms Same recordset Screen size Side-by-side

Animal

AnimalID

Sale=AnimalID from Animal form

- - - - - - -- - - - - - -

Subtotal=Sum(Price*Quantity)

=Forms!Sale!ItemsSold.Form!Subtotal

ItemsSold

=Subtotal*[TaxRate]

SubtotalTax

=Subtotal+TaxOrderTotal

Page 30: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

30

DDAATTAABBAASSEE

Integrity Avoid relying on forms

Set integrity conditions in table definitions

Be sure to set referential integrity (relationships)

Use forms to make it easy to enter quality data Combo/list boxes Menus Pop-up forms Ties to related forms Data transfer across forms Computations Error checking & trapping

Controls Security rights Data formats

Data entry Round-off

Selectivity Visible Enabled & Locked Example: no production

change after item is sold.

User assistance Tool tips Status bar Menu Help--context sensitive

Page 31: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

31

DDAATTAABBAASSEE

Large Projects Design Standards Templates

Colors, layout Titles Actions, common buttons

Naming convention is crucial Forms Controls Event procedures Variables

Team Coordination Menu design

Within a form/standards Across an application

Event / action diagrams State diagram Scenario diagram/messages

Switchboard form

Customer Order

Assembly

Orderform

Assemblyform

Order form

Item#

BackorderNotice& Form

item notavailable

Customer#

CustomerDiscount

largecustomer

Page 32: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

32

DDAATTAABBAASSEE

Objects

Scenario diagrams Objects Properties Events Messages

CustomerOrder object

MarketPricingObject

Message: computediscount usingCustomer ID& Order size

Message: discount pct

Messages are usually initiated by calling exposed functions in an object

Data can be passed directly, or made available by exposing properties

Page 33: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

33

DDAATTAABBAASSEE

International Attributes

Language Character sets and

punctuation marks Sorting Data formats

Date Time Metric v English Currency symbol and format Separators (decimal, . . .) Phone numbers

Separators International code prefix

Postal codes National ID Numbers

Page 34: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

34

DDAATTAABBAASSEE

Direct Manipulation of Objects

A graphical approach. Minimize data entry. Drag and drop objects (blue arrows).

Tabby

Brown Lab

Current Choices

Kennel/OrdersBird

Cat

Dog

Spider

Fish

Mammal

Reptile

Customer

Page 35: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

35

DDAATTAABBAASSEE

Creating a Graphical Approach Get the hardware.

Images: Scanners Sound: Microphone and Sound card Video: Camera and capture card Lots of disk space. High speed processors.

Add an object column to your table definition. Design the screens.

Be creative. Get user input. Make the user’s job easier. Avoid using graphics just for show. Double-click Drag-and-drop

Programming!

Page 36: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

36

DDAATTAABBAASSEE

Oracle FormsUse List of Values (LOV) instead of select boxes.

Page 37: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

37

DDAATTAABBAASSEE

Oracle Forms Designer

Page 38: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

38

DDAATTAABBAASSEE

Oracle Forms: Sales

Oracle provides minimal support for updateable queries, so several items are grayed out to indicate they cannot be changed here.

Page 39: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

39

DDAATTAABBAASSEE

Oracle Forms: Sales Design

Two new data blocks are used for the repeating sections.

Page 40: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

40

DDAATTAABBAASSEE

Oracle Forms Design Hints

Displaying non-updateable data from other tables is tricky. In Master/Sale set: DML Data Target Type = Table DML Data Target Name = Sale For SaleID, set PrimaryKey = Yes

Add the other tables Query Data Source Type = Table Query Data Source Name (parentheses are critical!)

(SELECT Sale.columns, Customer.Columns, Employee.Columns FROM Sale, Customer, Employee WHERE (Sale.CustomerID = Customer.CustomerID) AND (Sale.EmployeeID = Employee.EmployeeID))

Page 41: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

41

DDAATTAABBAASSEE

Oracle Forms Hints

General – Name: cLastName

Functional – Enabled No (optional but clearer to the user)

Database – Database Item Yes

Database – Column Name cLastName

Database – Query Only Yes

Database – Insert Allowed No

Database – Update Allowed No

Add non-updateable columns by hand. Use aliases in the query to ensure all column names are unique. Then set properties:

Page 42: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

42

DDAATTAABBAASSEE

Report Design

Security controls Distribution list Unique numbering Concealed/non-printed

data Secured printers Transmission limits Print queue controls

Output concerns Typefaces

ReadabilitySizeUser disabilities

OCR needs

Report usage/user needs. Report layout choices.

Tabular Columns/Subgroups Charts/graphs

Paper sizes. Printer constraints. How often is it generated? Events that trigger report? How large is the report? Number of copies? Colors?

Page 43: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

43

DDAATTAABBAASSEE

Terminology Page Layout

Landscape v. portrait Margins Gutter (binding space)

Typefaces

Serif (Times New Roman)Sans-serif (Arial)OrnamentalFixed width

Font size common: 10 - 12 point 72 points approx. 1 inch pica (1/6 inch) (12 points)

Facing pages (portrait)

guttermargins

Landscape

Alignment marks for color separations.

Page 44: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

44

DDAATTAABBAASSEE

Report Types: Tabular

Page 45: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

45

DDAATTAABBAASSEE

Report Types: Labels

Page 46: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

46

DDAATTAABBAASSEE

Report Types

Column. Column with groups.

Page 47: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

47

DDAATTAABBAASSEE

Report Layout

Report Header Page Header Group Header1

Group Header2 . . . Detail . . .

Group Footer2

Group Footer1 Page Footer Report Footer

Page 48: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

48

DDAATTAABBAASSEE

Report Layout/Common Use

Group Footer Subtotals for the group.

Page Footer Printed at the bottom of

every page--page totals or page numbers and notes.

Report Footer Printed one time at the end

of the report. Summary notes, overall totals and graphs for entire data set.

Report Header Title pages that are printed

one time for entire report.

Page Header Title lines or page notes that

are printed at the top of every page.

Group Header Data for a group (e.g.,

Order) and headings for the detail section.

Detail Innermost data.

Page 49: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

49

DDAATTAABBAASSEE

Report of Orders

Rpt footer: graph orders by customer

Group1: CustomerH1: Customer name, address, …

F1: Customer total orders:

Group2: OrderH2: Order#, Odate, Salesperson.

F2: Order total: Sum(Extended)

Detail: Item#, Qty, Extended

Report Layout/Groups

Often use groups/breaks for one-to-many relationships.

Use a query to join all necessary tables. Can include all columns. Use query to create

computed columns (e.g., Extended:Price*Quantity).

Avoid creating aggregates or subtotals in the query.

Each one-to-many relationship becomes a new subgroup.

Customer(C#, Name, …) Order(O#, C#, Odate, …) OrderItem(O#, Item#, Qty, …)

Page 50: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

50

DDAATTAABBAASSEE

Report Computations

Query Same row computations. Extended=Price*Quantity

Report Group subtotals. Page and report totals. Mixed, e.g., commission = rate * total Scope depends on location

Group footer: subtotalPage footer: page totalReport footer: report total

Page 51: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

51

DDAATTAABBAASSEE

Report Graphs Graphs

Separate query. Detail

Locate in detail or group footer section.Avoid aggregation and groups in query. Include column that links to detail query in

report.

Subtotals and totalsTypically located in report footer or header.Compare group totalsRelies on Group By and aggregation.Be sure query groups match report groups.

Page 52: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

52

DDAATTAABBAASSEE

Report Graph for Group

Page 53: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

53

DDAATTAABBAASSEE

Oracle Report Writer: Preview

Page 54: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

54

DDAATTAABBAASSEE

Oracle Report Writer: Design

Page 55: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

55

DDAATTAABBAASSEE

Oracle Reports: Data View

The data view can be used to create reports with complex data structures. It is primarily used for master/detail reports.

In this example, each supplier can be sent many purchase orders, which each contain many items being ordered. The report can produce group breaks on all three sections.

Page 56: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

56

DDAATTAABBAASSEE

Customer ReportFile Edit Help File Edit Help

Application Features

Application organization Menu Toolbar Help Transactions Improving forms Customized reports Distributing Applications

Sales Report

File Edit Help File Edit Help

SwitchboardSwitchboard

Page 57: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

57

DDAATTAABBAASSEE

Application Design

Customer Form Order Form Bad design:

Enter data twice.

Poor design: Memorize data (ID) on one

form to enter on second.

Better design: Automatically transfer data

across forms.

Customer1592Jane Doe333 Elm St.

OrderCustomer:1592 Jane Doe333 Elm St.

Page 58: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

58

DDAATTAABBAASSEE

Application Importance

User interface Make users’ jobs easier. Tie input forms and reports. Automate basic tasks Tie to external data

collection devices. Help system.

Ensure data integrity Validate data. Perform computations. Verify totals. Control user access. Maintain related

transactions. Backup and recovery.

Decision Support Monitoring of events. Analysis, Graphs, Reports. Statistical analysis and

optimization. Forecasts and simulation. Linking to other software.

Expert Systems & Intelligence Logic and forward chaining. Analysis and decisions in

code. Databases of cases,

situations and solutions.

Page 59: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

59

DDAATTAABBAASSEE

Application Organization Organized by user needs.

Identify user. Outline tasks. Organize forms and reports.

Direct users to tasks. Potential drawbacks

Too many layers makes it difficult for users to find anything.

Poor organization confuses users and requires additional support and training.

Build forms and reports. Start with a core concept.

Identify most important features. Get them correct.

Add features, forms and reports. Issue application updates--number and date!

Use menu stubs for incomplete and future work. Make them invisible to the

user with the Visible property.

Be sure they are disabled.

Page 60: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

60

DDAATTAABBAASSEE

Application Structure

DatabaseOracleSQL ServerDB2Access

Forms and ReportsVisual BasicInternetOracle Forms

Back end

Front end

If x > 10,000 ThenElseEnd If

Middle Tier(Optional)Business logicRules

Page 61: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

61

DDAATTAABBAASSEE

User Orientation

Database application is a model of the organization. Applications based on user jobs. Flexibility and user control.

Application organization User tasks. User control over sequence.

Forms Minimize user entry. Anticipation.

Reports Easy access from forms. User selection of scope and

conditions or filters.

Page 62: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

62

DDAATTAABBAASSEE

Initial Menu / Switchboard

Starting point for users. Identify the user.

From network if possible. Separate log in if needed.

Customized for users. Hide restricted options. Different forms as needed.

Avoid cluttered screens. Use graphics and color to

enhance the presentation. Limit the number of options.

Page 63: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

63

DDAATTAABBAASSEE

Switchboard Uses

Acts as a directory for the application. Identifies users. Contains startup and shutdown code.

Can preload forms in background. Make them invisible. Speed up later usage.

Can initiate transaction and security logs. Can establish network connections.

Contains copyright and usage notes.

Page 64: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

64

DDAATTAABBAASSEE

Sally’s Pet Store: Poor Organization

OrderMerchandise

Item

ReceiveMerchandise

Item

SellMerchandise

Item

GetCustomer

Data

What is wrong?

Focus needs to be at higher level (Order, Receipt, Sale); not Item.A

You cannot go from Order to Receipt.

You cannot go from Receipt to Sale.

You need to get customer data before recording the sale.

Page 65: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

65

DDAATTAABBAASSEE

Sally’s Pet Store: Better Organization

Orders Receipt

Sale

Supplier

Customer

InventoryItems

specialorders

More links--usually as buttons.

Separate sales from orders, except for special orders.

Page 66: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

66

DDAATTAABBAASSEE

Sally’s Pet Store: Initial VTOC

Sales

Animals

Customers

Suppliers

Purchase Merchandise

Sale Animal

Sale Merchandise

Customer Receipts

Supplier Payments

Animal Health

Animal Genealogy

Purchase Animals

Accounting

Marketing

Employees

Sales Report

Cash Flow

Accounts Payable

Accounts Receivable

Inventory

Page 67: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

67

DDAATTAABBAASSEE

Menus Why a custom menu?

Limit user actions. Simplify user interface. Add custom actions. Menus can be activated by

keystrokes.AccessibilityTouch-typists and

heads-down data entry. Sometimes need different

menus for each form.

File Help

Contents

SearchAbout Rolling Thunder

File HelpEdit

Add Customer

Delete Customer Ctrl+DModify Customer Data

Page 68: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

68

DDAATTAABBAASSEE

Creating Menus

View | Toolbars | Customize Drag and Drop

Multilevel menu.Sublevels/hierarchy.Each level is a separate menu with its

own name.

Menu choicesEach entry has a name.Access key: & (e.g., &File).Status Bar Text

ActionsSubmenu.Run any code.

Page 69: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

69

DDAATTAABBAASSEE

Toolbars

Why toolbars? Single click for complex

actions. Commands available across

the application / shortcuts. Position and customization

by user.

Toolbar components Button

Text Icon/graphic (bitmap)

Tool Tip Status Bar description Action

Print

·Identify report

·Ask for single or multiple pages.

·Preview or print.SwitchboardSwitchboard

Weekly Sales AnalysisBuild graphsPrint reportsExport data to spreadsheet

Page 70: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

70

DDAATTAABBAASSEE

Menus and Toolbars

Page 71: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

71

DDAATTAABBAASSEE

Creating Toolbars View | Toolbars | New Customizing

Add new button.Select from DBMS list.Bring up query/form/report.Run code.

Change icon.Modify existing icon.Replace icon.Create your own icon and paste it on the button.Place text label on button.

Tool tips are vital. Status bar for description.

Page 72: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

72

DDAATTAABBAASSEE

Icons

16 by 16 pixels 16 colors

Bright and shaded Dither to mix colors

Outline in black

Page 73: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

74

DDAATTAABBAASSEE

Help

On-line help replaces manuals Context sensitive:

Pressing F1 key provides information on topic with current focus

Hypertext links to related topics Sequential topics

DescriptionsExamples

Definitions / Glossary Contents / overview Index / keywords Full-text search

Windows 95 & Win-NT

Sally’s Pet Store--ContentsCopyright NoticeThe Firm Introduction ProcessesEntering Data Sales Animal Health

Breeds (and other terms)

Page 74: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

75

DDAATTAABBAASSEE

HTML Help

Get the Microsoft HTML Help Workshop: http://msdn.microsoft.com/library/tools/htmlhelp/ Create each of the following

Help project files Use separate directory

HTML topic files Standard HTML with some additions for keywords

Topic Header and Text File Graphics and multimedia

Avoid monster sizes Contents files

Can auto-generate from heading tags (<H1>, <H2>, …) Index files

Use Help workshop to set keywords within each topic

Page 75: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

76

DDAATTAABBAASSEE

HTML Help Workshop

Page 76: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

77

DDAATTAABBAASSEE

HTML Project Hints

Project OptionsProject TitleDefault file (first page)

Can create new files with File - NewBe sure to Add/Remove Topic files to project listEdit – Compiler Information to add keywords to HTML file

Concentrate on creating useful help content On large projects, hire/train someone to manage help

Add useful featuresKeep content up to dateManage/organize all the files

Page 77: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

78

DDAATTAABBAASSEE

Context-Sensitive HelpSet the help file name in the form properties.

Set the topic number (Context Id) for each form or control.

Page 78: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

79

DDAATTAABBAASSEE

Context Sensitive HTML Help

Create a Topic file for pop-up topics

Create a header file to link the topic names to numbers

Use HTML API to set the filenames.topic Filename1

Description

.topic Filename2Description

#define Filename1 10000

#define Filename2 20000

Page 79: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

80

DDAATTAABBAASSEE

Appendix: Oracle PL/SQL: Data Types

Primary Data TypesNUMBER(precision, scale)

precision: Number of digitsscale: Round-off pointNUMBER(7,4): 123.4567

INTEGERDefault: NUMBER(4)

BOOLEANYes/No

CHARFixed length string

VARCHAR2Variable length string

LONG, LONG RAWBinary data

DATE

Page 80: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

81

DDAATTAABBAASSEE

Appendix: Oracle PL/SQL StructureCREATE OR REPLACE PACKAGE myPackage ASPROCEDURE myProcedure(oldProjectID IN NUMBER);END myPackage;

CREATE OR REPLACE PACKAGE BODY myPackage ASDECLARE

myGlobalVar NUMBER;

PROCEDURE myProcedure(oldProjectID IN NUMBER) ISDELCARE

myLocalVar NUMBER;BEGIN

myLocalVar := oldProjectID;IFEND IFCOMMIT;

END myProcedure;

End myPackage;

Page 81: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

82

DDAATTAABBAASSEE

Appendix: PL/SQL Operators

Page 82: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

83

DDAATTAABBAASSEE

Appendix: PL/SQL IF-THEN-ELSE-ELSEIF

DECLAREX NUMBER(10,2);

BEGIN-- retrieve the balanceIF (BALANCE > 0) THEN

X = BALANCE*1.10;ELSE

X = 0.0;END IF;

END;

IF (ACCOUNT = ‘P’) THEN-- do personal accounts

ELSEIF (ACCOUNT = ‘C’) THEN-- do corporate accounts

ELSEIF (ACCOUNT = ‘S’) THEN-- do small business

ELSE-- handle error

END IF;

Watch the semicolons!

Use ELSEIF for case statements.

Page 83: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

84

DDAATTAABBAASSEE

Appendix: PL/SQL Loops

(Start statement)

LOOP

EXIT;

EXIT WHEN (condition);

END LOOP;

WHILE (condition) LOOP

END LOOP;

FOR (variable) IN low...high LOOP

END LOOP;

Page 84: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

85

DDAATTAABBAASSEE

Appendix: Procedures or Subroutines

PROCEDURE DropOldAccounts (CutDate DATE) IS-- local variables are defined here

BEGIN-- First copy the data to a backup tableINSERT INTO OldAccountsSELECT * FROM Account WHERE AccountID NOT IN

(SELECT AccountID FROM Order WHERE Odate > CutDate);

-- Copy additional tables… -- Delete from Account automatically cascades to

othersDELETE FROM Account WHERE AccountID NOT IN

(SELECT AccountID FROM Order WHERE Odate > CutDate);

END DropOldAccounts;

Page 85: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

86

DDAATTAABBAASSEE

Appendix: SQL CursorsDECLARE

CURSOR c1 ISSELECT Name, Salary, DateHired FROM Employee;

varTotal Employee.Salary%TYPE;BEGIN

varTotal = 0;OPEN c1;FOR recEmp in c1 LOOP

varTotal := varTotal + recEmp.Salary;END LOOP;CLOSE c1;-- Now do something with the varTotal

END;

Page 86: Jerry Post Copyright © 2003 1 Database Management Systems Chapter 6 Forms and Reports.

87

DDAATTAABBAASSEE

Appendix: Error Handling

PROCEDURE myProc ( ) ISDECLARE

-- declare all local variablesBEGIN

-- SQL statements hereEXCEPTIONWHEN OTHERS THEN -- you can specify a particular error

-- but OTHERS captures all errors-- PL/SQL code to execute if an error arises

END myProc;