Pennsylvania Banner Users Group APEX Day at Immaculata APEX 101

Preview:

Citation preview

Pennsylvania Banner Users Group APEX Day at Immaculata

APEX 101

Lehigh Carbon Community College (LCCC)

Developer: Wayne Youngblood wyoungblood@lccc.edu

DBA: Don Thaler dthaler@lccc.edu Over 40 APEX applications used in

Production at LCCC

Objectives

Show some useful APEX links A quick look at LCCC’s current APEX architecture A look at the APEX development environment Build a simple application from scratch. Create a

region, item, button, process, and SQL report. Introduce a simple JavaScript call Export the application to an OS file Import the application to another Database Instance

What is APEX

Oracle’s Application Express (formerly called HTMLDB)

A hosted declarative development environment for developing and deploying database-centric Web applications.

Users work in a dedicated work area called a workspace.

A workspace is a virtual private database that enables multiple users to work within the same Oracle Application Express installation while keeping their objects, data and applications private.

Some useful APEX links

APEX Forum http://www.oracle.com/splash/forums/index.html

APEX User Guide http://download.oracle.com/docs/cd/E10513_01/doc/appdev.310/e10499/index.htm

APEX Advanced Tutorial http://download.oracle.com/docs/cd/E10513_01/doc/appdev.310/e10497/toc.htm

JavaScript Tutorial http://www.w3schools.com/js/default.asp

LCCC’s APEX Setup

APEX engine is installed in LCCC’s Banner instances The Application Server is Windows Server 2003 Entries in the Application Server’s marvel.conf file determine

what URL points to what Banner Database instance (mod_plsql cartridge)

Examples:

1. Entries within this tag <Location /pls/htmldb> are for LCCC’s production Banner instance. The URL to the Production APEX development environment is http://banforms:7778/pls/htmldb/f?p=4550:8

2. Entries within this tag <Location /pls/pprd> are for LCCC’s pre-production Banner instance. The URL to the Pre-Production APEX development environment is http://banforms:7778/pls/pprd/f?p=4550:8

The APEX Development Environment Application Builder (the focus of today) SQL Workshop Utilities

Application Builder

Lists all of the applications residing in the Workspace you are logged on to.

Application Builder

Can display icons (previous slide) or details (below)

Application Builder

When “clicking” into an application, the pages of the application are available to edit

New pages can be created Additional icons appear at the top of the

screen for1. Running the application (to test any

functionality)

2. Supporting Objects (not in today’s scope)

3. Shared Components

4. Export/Import

Application Builder

Build an Application

Build an Application Name & Schema

Build an Application Add Page(s)

Build an Application Add Page(s)

Build an Application Add Tabs

Build an Application Shared Components

Build an Application Authentication

Build an Application Theme

Build an Application Confirmation

Build an Application Ready to Edit

Editing a page layout

Three areas of page editing

1. Page Rendering

2. Page Processing

3. Shared Components

Editing a page Region Creation

Add a region to hold items you create, even hidden items

Editing a page Region Creation

Editing a page Region Creation

Add Region name and choose display point

Editing a page Region Creation

New region appears in Region section of Page Rendering.

Editing a page Items

Create a Banner Term select list using a query

Editing a page Items

Select list with submit. Submitting will save the selected value in the item.

Editing a page Items

Choose a name for the item and select the region it will reside in.

Editing a page Items

Enter Null Text, Null Value, and the query for the select list.

Editing a page Items

Editing a page Items

A closer look at the select query (in previous slide)select distinct substr(SOBTERM_TERM_CODE,1,4) || ' ' ||

decode(substr(SOBTERM_TERM_CODE,5,2), '10', 'Spring', '20', 'Summer', '40', 'Fall', '15', 'Spring', '45', 'Fall') || ' ' ||

decode(substr(SOBTERM_TERM_CODE,6), '0', 'Credit ','Non Credit ')

d,

SOBTERM_TERM_CODE r

from sobterm

where sobterm_term_code >= (select max(sobterm_term_code) - 200 from sobterm)

order by 2 desc

Editing a page Items

Add Label. Default is the item name without the “P1_” prefix.

Editing a page Items

Enter the Source. This was done in the previous step with the query. No Action needed.

Editing a page Items

Derive Item Source. Leave the default.

Editing a page Items

The new item now appears in the Item section of page rendering.

Select list with submit warning

When you use a select list with submit (or any other item with submit), you need to create an unconditional branch to return to the current page or you will see this error message when selecting from the list:

Unconditional Branch

Create the unconditional branch in the Branches section under Page Processing

Unconditional Branch

Use the Branch Point default and select the “Branch to Page” Branch Point

Unconditional Branch

Select the page to branch to. In this case there is only page 1. Select the include process success message.

Unconditional Branch

There are no conditions, so click the “Create Branch” button.

Unconditional Branch

The new branch will be listed under the Branches section of Page Processing.

Editing a page Buttons

Create a button in the “Item Hold Region”.

Editing a page Buttons

Keep default of “Create button in region position”.

Editing a page Buttons

Give the button a name and Label. Leave default action to submit the page.

Editing a page Buttons

Keep the button template default

Editing a page Buttons

Select the region position and the alignment for the button.

Editing a page Buttons

Enter page to branch to when button is pressed. In this case we branch back to the current (and only) page in the application.

Editing a page Buttons

Select when or if you want the button displayed. In this case we have no conditions, so we just click the “Create Button” button.

Editing a page Buttons

The new button now appears in the Button section of Page Rendering. Additionally, a new branch appears in the Branches section of Page Processing.

Create a Process

Use the default PL/SQL process

Create a Process

Name the process (spaces in name okay) and keep the default Process Point, On Submit.

Create a Process

Enter the PL/SQL. In PL/SQL any page item must be referenced like a bind variable (with the colon). You can also use anonymous blocks. This example is simply setting the P1_TERM item to null.

Create a Process

Enter Success or Failure messages. In more complex processes you would capture SQLERRM and display here in a hidden page item (e.g. P1_MSG). This is a simple process that does not access Banner, so leave blank.

Create a Process

Choose the CLEAR button from the “When button Pressed” list. Any button you create on a page will appear in this list. Click the “Create Process” button.

Create a Process

The new process now appears in the Processes section of Page Processing.

Running the Application in the Development environment When you run the application in the development environment, the

bottom of the screen allows you to go back to editing the Application or individual page you are working on. Edit links and debug are also available.

Creating as SQL report

Create a new Region. This is a Report Region.

Creating a Report

Specifically, an SQL report.

Creating an SQL report

Enter a title for the report. Select your desired display point (leaving the default in this example).

Creating an SQL report

Enter SQL for the report.

Creating an SQL report

Closer look at the report SQL:select SSBSECT_SUBJ_CODE,

SSBSECT_CRSE_NUMB,

SSBSECT_SEQ_NUMB,

SSBSECT_CREDIT_HRS,

SSRMEET_DAYS_CODE,

SSRMEET_BEGIN_TIME,

SSRMEET_END_TIME,

SSRMEET_BLDG_CODE,

SSRMEET_ROOM_CODE

from ssbsect, ssrmeet

where SSBSECT_TERM_CODE = :P1_TERM

and SSBSECT_TERM_CODE = SSRMEET_TERM_CODE

and SSBSECT_CRN = SSRMEET_CRN

Creating an SQL report

Choose the look of the report (default used here).

Creating an SQL report

Put a condition on the report. In this case we are using a PL/SQL expression the :P1_TERM is not null.

Creating an SQL report

The report now appears in the Regions section under Page Rendering.

Displaying the report

You can modify the report attributes to give columns more meaningful names than the Banner table names.

Displaying the report

By the report Title (Courses) is a link Report. When you click on that link you are in the Report Attributes area.

Displaying the report

Choose Custom radio button for “Headings Type” and you can change the headings.

Displaying the report

The changed headings. You can use HTML <bra> tag in the headings.

Displaying the report

The report after changing the headings.

Adding JavaScript Hourglass

You can add JavaScript in the HTML Header of the Page section under Page Rendering. LCCC’s practice is to paste a template (next slide) that contains the JavaScript tags. The template also includes functions for changing the mouse pointer to an hourglass and changing the mouse pointer back to the default when entering (or re-entering) the page.

Adding JavaScript Tags and common mouse pointer functions.

<script type="text/javascript">

function initPage()

{

document.body.style.cursor = "default";

}

function mouseWait()

{

document.body.style.cursor = "wait";

}

function mouseDefault()

{

document.body.style.cursor = "default";

}

</script>

Adding JavaScript onLoad function

In the HTML Body Attribute we call the initPage() function on the “onLoad” JavaScript event. When you do this you must set Cursor focus to “Do not focus cursor” in the Display Attributes section. Using JavaScript you can place focus on any item you want.

Adding JavaScript

Now you can see we have JavaScript entered in the HTML Header. We can add functions in there for page items by clicking on the link and editing the HTML Header area.

Adding JavaScript Clear button

To add JavaScript the Clear button, we will … Create a new Clear button that will call the JavaScript

function. Hide the current Clear button. This is still linked to our

process. The JavaScript function we create will submit this button.

Create the JavaScript function to confirm that we want to clear the contents of the page (i.e. setting the P1_TERM to null.

Adding JavaScript Clear button

Create a new button named CLEAR_D (needs a different name). We use _D for “display”, but it can be named anything other than CLEAR.

The Label can be the same. For Action, select the radio button labeled “Redirect to URL without submitting page”

Adding JavaScript Clear button

Don’t forget where you want the button to be displayed.

Adding JavaScript Clear button

Because we selected “Redirect to URL without submitting page” in the previous step, a branching section appears. Select “URL” for target and enter javascript:confirmClear(); as the URL target. confirmClear() can be any name you want as long as it matches the function you enter in the HTML Header.

Adding JavaScript Clear button

Hide the original Clear button we created. Click on the link and make the condition “never”. Note the new button is listed and the JavaScript function it is linked to is displayed.

Adding JavaScript Clear button

After the original Clear button is hidden. Again, this button is still linked to the process so we still need it. Next we create the function confirmClear() in the HTML Header.

Adding JavaScript Clear button

Edit the HTML Header and create the confirmClear() function:

function confirmClear()

{

var msg = 'Do you really want to clear this page for term ' + $x('P1_TERM').value + '?';

if ( confirm (msg) )

{

mouseWait(); // set the hourglass on

doSubmit('CLEAR'); // the hidden button linked to the process

}

}

Adding JavaScript Clear button

Now when you click the Clear button you are prompted with the below message to confirm. This is useful when you are updating Banner and you want to give the user a chance to back out.

Exporting

To export an application, click the Export/Import icon at the application level and follow the prompts.

Exporting

All the values are pre-populated.

Exporting

After clicking the “Export Application” button, the File Download dialog appears. Note the file name F121.sql. 121 is the application’s unique ID in this database instance.

Exporting

Save the file to whatever directory you keep your applications, preferably a server that gets backed up.

Importing

Log into the instance you want the users to access the application (if it is a different instance). Go to application builder and Click the Import button.

Importing

Use the Browse button to find your application.

Importing

Use the Browse button to find your application.

Importing

Click “Next” until you see this screen. Select the parsing schema and Reuse Application ID and click the Install button.

Importing

After the application is installed you can click the Run Application icon and copy the URL for your users.

Importing

After the application is installed you can click the Run Application icon and copy the URL for your users. You only need to copy up to the f?p=121:1 That is the application id and page. The rest is the current session id.

Importing

When the user enters http://banforms:7778/pls/htmldb/f?p=121:1 they will get the application only, not the APEX development environment.

Importing Application as seen by the user

Some LCCC Applications

Pennsylvania Secure ID Reports students who have PA assigned

Secure IDs (GORADID). Extracts students from Banner who need IDs

assigned. Creates csv file in the state’s required format.

Updates GORADID table when state assigns IDs. Application uploads the csv file, then updates GORADID.

Some LCCC Applications

Course Date Change Change start and end dates for part of terms. Can move CRNs to different part of terms. Change dates for non-credit courses.

Some LCCC Applications

Student Email Lookup Allows the help desk or student services to fix

student email issues. Show last accessed. Allows manual creation of email accounts in

case that is needed.

Some LCCC Applications

Population Selection Allows users the ability to paste Student IDs

from various spreadsheets and create a mass entry into GLBEXTR.

Non-Credit Course Lookup A tool for the website manager to quickly

check Banner if non-credit courses are missing from the website. Tools like this are handy for people that do not use Banner.

Some LCCC Applications

Send Student Email Application lets the user paste student IDs

from a spreadsheet to obtain email addresses.

Choose who the “from” will be (registrar, bursar, marketing, etc.)

Compose and send email. All email addresses put in blind copy.

Send out in batches when blind copy gets close to 4000 characters.

Open to the Floor

Questions Comments

Recommended