Week 10 April 5

43
1 . Ching, Ph.D. • MIS Area • California State University, Sacramento . Ching, Ph.D. • MIS Area • California State University, Sacramento Week 10 Week 10 April 5 April 5 Subquery and Thresholds Subquery and Thresholds Graphics Builder and Forms Graphics Builder and Forms

description

Week 10 April 5. Subquery and Thresholds Graphics Builder and Forms. The Importance of ORDER BY. Relying on Fate…. View name. What’s the Problem?. Ordered by record labels!. 140 rows. All 2001. Paste the New Query into the Dialog Box. Revised Graph. Too many lines!. - PowerPoint PPT Presentation

Transcript of Week 10 April 5

Page 1: Week 10 April 5

1

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

Week 10Week 10April 5April 5

• Subquery and ThresholdsSubquery and Thresholds• Graphics Builder and FormsGraphics Builder and Forms

Page 2: Week 10 April 5

2

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

The Importance of ORDER BYThe Importance of ORDER BY

Page 3: Week 10 April 5

3

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

View nameView name

Relying on Fate…Relying on Fate…

Page 4: Week 10 April 5

4

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

What’s the Problem?What’s the Problem?

Page 5: Week 10 April 5

5

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

Ordered by record labels!Ordered by record labels!

Page 6: Week 10 April 5

6

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

All 2001All 2001

140 rows140 rows

Page 7: Week 10 April 5

7

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

Paste the New Query into the Dialog BoxPaste the New Query into the Dialog Box

Page 8: Week 10 April 5

8

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

Revised GraphRevised Graph

Too many lines!Too many lines!

Page 9: Week 10 April 5

9

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

What’s a Threshold and Why Do We Need It?What’s a Threshold and Why Do We Need It?

Page 10: Week 10 April 5

10

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

Not much usable informationNot much usable information

Page 11: Week 10 April 5

11

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

Reduce the Number of Record LabelsReduce the Number of Record Labels

Top 7 record labels in salesTop 7 record labels in sales

Page 12: Week 10 April 5

12

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

Create a set of threshold valuesCreate a set of threshold values

Every record label must beat every value in this set, Every record label must beat every value in this set, OR simply every record label must beat the highest OR simply every record label must beat the highest (i.e., maximum) value in this set(i.e., maximum) value in this set

Highest valueHighest value

Page 13: Week 10 April 5

13

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

REC 2001 2002 2003 2004 2005REC 2001 2002 2003 2004 2005--- ----------- ---------- ---------- ----------- -------------- ----------- ---------- ---------- ----------- -----------RCA RCA 98562.8898562.88 96126.71 99773.52 112097.35 108383.4296126.71 99773.52 112097.35 108383.42COL 2285882.3 2336707.93 2472875.7 2635497.41 2621255.29COL 2285882.3 2336707.93 2472875.7 2635497.41 2621255.29GRP 448870.6 469021.43 480428.06 531105.46 518445.68GRP 448870.6 469021.43 480428.06 531105.46 518445.68GTS GTS 156955.23 154830.01 174953.32 196814.02 200256.45156955.23 154830.01 174953.32 196814.02 200256.45WB 571478.66 576644.41 580731.48 587747.77 563445.49WB 571478.66 576644.41 580731.48 587747.77 563445.49ARI 638935.25 628407.24 625556.25 644993.73 601378.96ARI 638935.25 628407.24 625556.25 644993.73 601378.96KUC KUC 48260.05 40662.4 36247.64 35417.3 30704.8948260.05 40662.4 36247.64 35417.3 30704.89VER VER 188098.59 202036.86 209501.61 245316.62 269777.58188098.59 202036.86 209501.61 245316.62 269777.58DOM DOM 106147.96 120980.78 118289.17 116859.98 120437.15106147.96 120980.78 118289.17 116859.98 120437.15LIB LIB 42279.47 42602.71 35975.38 39944.48 57172.1842279.47 42602.71 35975.38 39944.48 57172.18S/A S/A 116819.02 131737.36 122668.75 137014.64 167739.88116819.02 131737.36 122668.75 137014.64 167739.88CAP 1019419.4 1007901.07 972170.61 1005423.39 976683.56CAP 1019419.4 1007901.07 972170.61 1005423.39 976683.56KOK KOK 59802.31 82005.05 78328.95 78980.63 85922.759802.31 82005.05 78328.95 78980.63 85922.7SHA SHA 62003.69 81029.3 94834.46 120347.68 128159.9162003.69 81029.3 94834.46 120347.68 128159.91DSY DSY 104735.01 97572.02 83157.61 88339.8 98077.64104735.01 97572.02 83157.61 88339.8 98077.64MCA MCA 343229.06 345217.11 365019.64343229.06 345217.11 365019.64 392166.76 381035.82 392166.76 381035.82MER MER 69748.69 69507.16 66263.35 61333.23 55619.2369748.69 69507.16 66263.35 61333.23 55619.23MOT MOT 252342.84 263438.36 259107.84 290508.9 300567.62252342.84 263438.36 259107.84 290508.9 300567.62NAS NAS 75892.67 91443.5 118311.33 172166.27 191768.3975892.67 91443.5 118311.33 172166.27 191768.39PM PM 350717.42 354469.91 355604.56 363074.29350717.42 354469.91 355604.56 363074.29 378489.29 378489.29WH WH 364718.11364718.11 374305.23 405000.86 483654.29 490804.67 374305.23 405000.86 483654.29 490804.67CHS CHS 62510.26 76541.45 109559.04 106997.1 93288.662510.26 76541.45 109559.04 106997.1 93288.6GEF GEF 70964.37 70399.53 70265.02 85641.58 88666.0770964.37 70399.53 70265.02 85641.58 88666.07APL APL 257074.33 296953.73 311523.14 324438.59 291354.25257074.33 296953.73 311523.14 324438.59 291354.25ATL 1017378.32 1023850.51 993520.05 1082629.88 1117300.7ATL 1017378.32 1023850.51 993520.05 1082629.88 1117300.7E/A E/A 83585.13 81487.22 99320.6 110026.61 118170.1683585.13 81487.22 99320.6 110026.61 118170.16EMI EMI 70391.52 71098.97 75852.13 69773.29 55397.9970391.52 71098.97 75852.13 69773.29 55397.99POL 469854.45 467419.28 485843.36 502552.77 453941.7POL 469854.45 467419.28 485843.36 502552.77 453941.7

YEAR THRESHOLDYEAR THRESHOLD---- -------------- ----------2001 330283.0162001 330283.0162003 346523.9202003 346523.9202005 369748.5842005 369748.5842002 337903.9032002 337903.9032004 371730.2342004 371730.234

HighestHighest

YesYes

YesYesYesYes

YesYes

YesYes

YesYes

YesYes

Eliminate the Eliminate the ones with redones with red

Page 14: Week 10 April 5

14

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

Working BackwardsWorking Backwards

• Create a set of all record labels that have all sales values Create a set of all record labels that have all sales values greater than those found in the set of thresholdsgreater than those found in the set of thresholds

All record labels must beat all threshold All record labels must beat all threshold values (or simply the minimum sales value values (or simply the minimum sales value must beat the maximum threshold value)must beat the maximum threshold value)

Page 15: Week 10 April 5

15

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

35 rows35 rows

Subquery: Select only those record Subquery: Select only those record labels that exist in the set that labels that exist in the set that contains record labels with sales contains record labels with sales values greater than all threshold values greater than all threshold valuesvalues

Retrieve all record labels annual sales Retrieve all record labels annual sales of those with minimum sales exceeding of those with minimum sales exceeding all values found in the thresholdsall values found in the thresholds

Page 16: Week 10 April 5

16

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

select category, year, salesfrom view1 alias1where exists

(select category, min(sales)from view1 alias2where alias1.category = alias2.categorygroup by categoryhaving min(sales) > all

(select threshold from view2)) Creates a set of threshold values

Creates a set of category members whose minimum sales must be greater than all threshold values

Retrieves only those category members that are found in the set produced by the first subquery

Anatomy of the Anatomy of the SubquerySubquery

Basic Query for the Data Model:

Page 17: Week 10 April 5

17

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

In Graphics BuilderIn Graphics Builder

Page 18: Week 10 April 5

18

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

A Few Simple Steps for Creating a GraphA Few Simple Steps for Creating a Graph(From Last Week)(From Last Week)

• Build the initial SQL command in SQL PlusBuild the initial SQL command in SQL Plus

• In Graphics Builder In Graphics Builder

– Build the data modelBuild the data model

– Build the graphBuild the graph

• Select the graph typeSelect the graph type

• Assign the independent and dependent to the Assign the independent and dependent to the categories and values, respectivelycategories and values, respectively

• Format the various components of graph as neededFormat the various components of graph as needed

• Save and run the graphSave and run the graph

Page 19: Week 10 April 5

19

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

Layout EditorLayout Editor

Tool palette

Chart tool - Create data model and graph

Page 20: Week 10 April 5

20

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

A few steps later…A few steps later…

After Building the GraphAfter Building the Graph

Page 21: Week 10 April 5

21

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

Generating an OGR FileGenerating an OGR File

From the File menu, select Administration, Generate and File System

Be sure to generate a new OGR file every time a change is made Be sure to generate a new OGR file every time a change is made to the OGD file.to the OGD file.

Be sure to generate a new OGR file every time a change is made Be sure to generate a new OGR file every time a change is made to the OGD file.to the OGD file.

Page 22: Week 10 April 5

22

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

Generating an OGR FileGenerating an OGR File

Save the file

Page 23: Week 10 April 5

23

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

In Form BuilderIn Form Builder

Page 24: Week 10 April 5

24

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

Create a Chart Item on the CanvasCreate a Chart Item on the Canvas

Select Data Block and the create tool in the tool palette

Page 25: Week 10 April 5

25

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

Create a Chart Item on the CanvasCreate a Chart Item on the Canvas

Select Build a new data block manually and click on OK

Page 26: Week 10 April 5

26

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

Create a New Item in the Data BlockCreate a New Item in the Data Block

Select Items and click on the Create Tool in the tool palette

Page 27: Week 10 April 5

27

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

Change the Item’s PropertyChange the Item’s Property

Right-mouse click the item (e.g., ITEM5) and select Property Palette

Page 28: Week 10 April 5

28

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

Change the Item Type PropertyChange the Item Type Property

1. Change the Item Type property from Text Item to Chart Item

Page 29: Week 10 April 5

29

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

Change the Canvas PropertyChange the Canvas Property

2. Change the Canvas property from <Null> to the canvas’ name (e.g., CANVAS2)

3. Close the Property Palette

Page 30: Week 10 April 5

30

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

Expand the Chart Item on the CanvasExpand the Chart Item on the Canvas

Page 31: Week 10 April 5

31

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

Attach the OG.PLL FileAttach the OG.PLL File

Select Attached Libraries and click on the create tool in the tool palette

Page 32: Week 10 April 5

32

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

Locate and Attach the OG.PLL FileLocate and Attach the OG.PLL File

1. Click on Browse and search for the file

2. Select the file and click on Open

Hint.Hint. Locate the OG.PLL file through a search in Windows Explorer and copy it into your Locate the OG.PLL file through a search in Windows Explorer and copy it into your working directory. It may be located under Developer’s \tools\devdem60\demo\forms working directory. It may be located under Developer’s \tools\devdem60\demo\forms subdirectory.subdirectory.

Page 33: Week 10 April 5

33

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

Attach the OG.PLL FileAttach the OG.PLL File

3. Click on Attach and select Yes (remove path)

Page 34: Week 10 April 5

34

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

1. Add a push button2. Right-mouse click the push button and select PL/SQL Editor

Page 35: Week 10 April 5

35

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

Select a TriggerSelect a Trigger

Select the WHEN-MOUSE-CLICK trigger and click OK

Page 36: Week 10 April 5

36

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

PL/SQLPL/SQL

Open and close the OGR file

Compile the PL/SQL code

Page 37: Week 10 April 5

37

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

Test the FormTest the Form

Page 38: Week 10 April 5

38

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

Test the FormTest the Form

Page 39: Week 10 April 5

39

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

Modify the Canvas PropertiesModify the Canvas Properties

Page 40: Week 10 April 5

40

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

Modify the Chart Item PropertiesModify the Chart Item Properties

Remove the bevel

Change the Background Color to match the canvas

Page 41: Week 10 April 5

41

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

First GraphFirst Graph

Page 42: Week 10 April 5

42

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

PL/SQLPL/SQL

Page 43: Week 10 April 5

43

R. Ching, Ph.D. • MIS Area • California State University, SacramentoR. Ching, Ph.D. • MIS Area • California State University, Sacramento

Second GraphSecond Graph