25
Oracle Application Express (APEX) Project Implementation for COSC 5050 Distributed Database Applications Lab3

Project Implementation for COSC 5050 Distributed Database Applications Lab3

Embed Size (px)

Citation preview

Page 1: Project Implementation for COSC 5050 Distributed Database Applications Lab3

Oracle Application Express (APEX)

Project Implementation for COSC 5050 Distributed Database

ApplicationsLab3

Page 2: Project Implementation for COSC 5050 Distributed Database Applications Lab3

Creating APEX ReportsCreating and customizing report

Column format (date/time, price)Column sortingPagination

Creating parameterized reportCreating drill down report

Page 3: Project Implementation for COSC 5050 Distributed Database Applications Lab3

Oracle APEX ReportAn Oracle APEX report is the formatted

result of a SQL queryReports can be generated by defining a

report region based on a SQL queryCreate a report based on a custom SQL

SELECT statement

Page 4: Project Implementation for COSC 5050 Distributed Database Applications Lab3

Editing Report AttributesCustomizing reports

SQL report and interactive reportAccessing the report attributes page from

report regionColumn attributesLayout and paginationSortingReport export/downloadBreak formatting

Page 5: Project Implementation for COSC 5050 Distributed Database Applications Lab3

Editing Report AttributesAltering report layout using column

attributes

Page 6: Project Implementation for COSC 5050 Distributed Database Applications Lab3

Editing Report AttributesAltering column nameAlignmentSortPagination – number of rowsReport export – CSV, xmlSum of columnFormatting number and date/timeColumn move up/down

Page 7: Project Implementation for COSC 5050 Distributed Database Applications Lab3

Creating Parameterized ReportParameterized report

The results depend on the form inputThe report region is based on a SQL query that

references the value of form items within the application

Will createA blank pageA search region

Form items Submit button

A query regionA process

Page 8: Project Implementation for COSC 5050 Distributed Database Applications Lab3

Creating a Blank PageUse AnyCo Corp application and add a new

blank pageIn the application home

Create Page Blank Page NextPage name: Parameterized ReportBreadcrumb: BreadcrumbBreadcrumb parent entry: Home

Page 9: Project Implementation for COSC 5050 Distributed Database Applications Lab3

Creating a Blank PageTab options

Use an existing tab set and create a new tab within the existing tab set

Tab set: TS1 (Home, Department, Employee)New tab label: Parameterized Report

Page 10: Project Implementation for COSC 5050 Distributed Database Applications Lab3

Creating a Search RegionCreate a search region

Edit the page right click Regions CreateRegion: HTML HTMLTitle: SearchTake other defaults Create

Page 11: Project Implementation for COSC 5050 Distributed Database Applications Lab3

Creating a Query RegionCreate a query region

Regions CreateType of region: Report Classic ReportTitle: Employee &P??_TEXT.

&P??_TEXT is a substitution string P?? is the page number, use your current page number Do not forget the period at the end, it is needed as

part of the titleEnter SQL Query (change to your page number)Column Heading Sorting: YesTake other defaults Create Region

Page 12: Project Implementation for COSC 5050 Distributed Database Applications Lab3

The Decode FunctionThe function has the functionality of an IF-THEN-

ELSE statementSyntax for the decode function

decode ( expression , search , result [, search , result]... [, default] )

Expression -- the value to compareSearch -- the value that is compared against expressionResult -- the value returned, if expression is equal to

searchDefault is optional

If no matches are found, the decode will return default If default is omitted, then the decode statement will return

null (if no matches are found)

Page 13: Project Implementation for COSC 5050 Distributed Database Applications Lab3

Testing the Created RegionsTwo regions have been created

HTML search regionSQL query report region

Page 14: Project Implementation for COSC 5050 Distributed Database Applications Lab3

Adding Form ItemsAdd following form items in the HTML search

regionThe search employee text field for P??_ENAMEA hidden text field for P??_TEXTThe department select list for P??_DEPTA submit button

Add a process to set the hidden text field

Page 15: Project Implementation for COSC 5050 Distributed Database Applications Lab3

Search Employee Text FieldCreate search employee text field for P??

_ENAMEEdit the page right click Search Create

Page Item Text fieldItem name: P??_ENAME

(use your page number)Region: SearchLabel: Search EmployeeTake other defaults Create Item

Page 16: Project Implementation for COSC 5050 Distributed Database Applications Lab3

Hidden FieldCreate hidden field for P??_TEXT

Edit the page right click Search Create Page Item Hidden

Item name: P??_TEXT (use your page number)Region: Employee &P??_TEXT. Take other defaults Create Item

Page 17: Project Implementation for COSC 5050 Distributed Database Applications Lab3

Department Select ListCreate department select list for P??_DEPT

Edit the page right click Search Create Page Item Select List

Item name: P??_DEPT (use your page number)Region: SearchLabel: DepartmentNull display value: – All –List of value query: Take other defaults Create Item

Page 18: Project Implementation for COSC 5050 Distributed Database Applications Lab3

Department Select List

Page 19: Project Implementation for COSC 5050 Distributed Database Applications Lab3

Submit ButtonTo submit the page, add a submit button

Once the user enters search criteria, the page needs to be submitted so that the query will be rerun against that criteria

Create buttonEdit the page right click Search Create Page Item ButtonButton name: P??_GOButton label: GoTake other defaults Create Button

Page 20: Project Implementation for COSC 5050 Distributed Database Applications Lab3

ProcessCreate a process that sets the value for the

hidden item P??_TEXT.The value of P??_TEXT determines the region

titleCreate process

In Page Processing area, right click Processes create

Category of process PL/SQLName: get region title infoEnter PL/SQL page process:Take other defaults Create Process

Page 21: Project Implementation for COSC 5050 Distributed Database Applications Lab3

Run Parameterized Report

Page 22: Project Implementation for COSC 5050 Distributed Database Applications Lab3

Creating Drill Down ReportLinking the Department report to the

Employee reportEdit department report page (page 2)In the Regions area:

Department Edit report Attributes

Page 23: Project Implementation for COSC 5050 Distributed Database Applications Lab3

Creating Drill Down ReportLinking the Department report to the Employee

reportEdit DETPNO column Column LinkLink text: #DEPTNO# (this is a template

substitution)Target: Page in this applicationPage: 5 (target to Parameterized Report page, use

your page number)Set item 1 session state

Name: P??_DEPT Value: #DEPTNO#

Apply Changes

Page 24: Project Implementation for COSC 5050 Distributed Database Applications Lab3

Creating Drill Down ReportClick department number to drill down to

employee report for the choose department

Page 25: Project Implementation for COSC 5050 Distributed Database Applications Lab3

ReadingsApplication Express User’s Guide

Building an Application Creating Reports

Application Express Advanced TutorialsHow to create a parameterized reportHow to create a drill down report