Upload
alaina-quinn
View
225
Download
0
Embed Size (px)
Citation preview
Saving $200,000 with Application
Express
A presentation for ODTUG Kaleidoscope 2006
June 21, 2006
Bill HoltzmanNational Air Traffic Controllers Association
Air Traffic Controllers
Most work for the Federal Aviation Administration (FAA), part of the US Government
National Air Traffic Controllers Association (NATCA) is the exclusive and official bargaining representative of air traffic controllers
NATCA
15,000 member organization 600 official representatives 400 offices across US $20 million budget High volume paperwork filings No internal network No programming staff One IT employee Headquartered in Washington, DC
My IT experience
Fortran, Drexel University, 1985 3 static HTML web sites, 1997-2002 Several MS Access apps, 2002-2003 7 one week classes at Learning
Tree Int’l, 2003-04 8i, 9i Intros, PLSQL, SQL Queries, App
Dev DBA, Backup & Recovery, Tuning
Grievances
Art. 9, Sec. 1. A grievance shall be defined as any complaint:
by any employee concerning any matter relating to the employment of the employee;
by the Union concerning any matter relating to the employment of any unit employee; or
by a unit employee or either Party concerning any claimed violation, misinterpretation, or misapplication of any law, rule or regulation affecting conditions of employment as provided in the Civil Service Reform Act of 1978 or this Agreement.
From the 1998 Collective Bargaining Agreement:
System requirements
Secure, internet-based Multiple access levels Event-based processing Timeline tracking Document storage Search Accelerated data entry Online reference library E-mail notifications Much more!
Grievance listing
From this listing users can access all information associated with each grievance and add new information. The light brown text are links to other pages or javascript.
A typical listing from the application.
SQL report region: Definition
Note: The image has been altered and the SQL simplified for this presentation.
HTML result (Automated link)
This HTML is generated by the ApEx engine for the column when the page is rendered. The image is the browser result.
<td class="alt" align="CENTER" ><a href="f?p=104:27:11611713660565463579::NO:: P27_GRID,P27_RETURN_PAGE:5360%2C32&cs=339E2700710A71397BE8B4014F66659CE" onMouseOver="return window.status='View or add attachments to this grievance'" onMouseOut="return window.status=''"><span style="padding:16px">4</span></a></td>
f?p=App:Page:Session:Request:Debug:ClearCache:itemNames:itemValues:PrinterFriendly
URL syntax
Note: %2C is a URL comma
Grievance listing
The NATCA/FAA column is more difficult to generate.
The light brown text is a link but the black text is not.
Manual report link
select '<a href="' || htmldb_util.prepare_URL('f?p=&APP_ID.:8:' || :APP_SESSION || ':::8:P8_DUP_GRID,P8_RETURN_PAGE,P8_ARTICLE:' || g.grid || ',32,' || g.article)|| '">' || g.natca || '</a><br><span style="font-size:8pt">' || g.faanum || '</span>' "NATCA2"from grievance g
This code is used to generate the values in the column.
SQL report region: Definition
Note: The image has been altered and the SQL simplified for this presentation.
HTML result (Manual link)
<td class="alt" align="CENTER" > <a href="f?p=104:8:11611713660565463579:::8: P8_DUP_GRID,P8_RETURN_PAGE,P8_ARTICLE:5380%2C32%2C1&cs=3AFB9E7AE3C788204B13372F5C05793B7" onMouseOver="return window.status='Duplicate this grievance'" onMouseOut="return window.status=''"> 06-ZDC-13</a> <br><span style="font-size:8pt">NC-AEA-ZDC-00120-2</span></td>
This HTML is generated by the ApEx engine for the column when the page is rendered. The image is the browser result.
Manual display conditions
selectdecode(g.status_id, 1, decode(g.date_sub_2, null, trunc(g.u_action_2) - trunc(sysdate) || ' ' ||casewhen (g.u_action_2 - sysdate) > 7 then '<img src="#FLOW_IMAGES#greenN.gif" alt="NATCA must submit this by ' || to_char(g.u_action_2, 'MM/DD/YY') || '">'when (g.u_action_2 - sysdate) > 3 then '<img src="#FLOW_IMAGES#yellowN.gif" alt="NATCA must submit this by ' || to_char(g.u_action_2, 'MM/DD/YY') || '">'when (g.u_action_2 - sysdate) > 0 then '<img src="#FLOW_IMAGES#redN.gif" alt="NATCA must submit this by ' || to_char(g.u_action_2, 'MM/DD/YY') || '">'when g.u_action_2 is null and date_rec_1 is null then '<img src="#FLOW_IMAGES#greenN.gif" alt="FAA has not replied at the E1 level">'else '<img src="#FLOW_IMAGES#past.gif" border="0" alt="NATCA failed to submit this by ' || to_char(g.u_action_2, 'MM/DD/YY') || '">'end,to_char(g.date_sub_2, 'MM/DD/YY')), 'Closed') "DATE_SUB"from grievance g
The column shows different elements depending on date data.
HTML result (Manual conditions)
<td class="alt" align="CENTER" >3  <img src="wwv_flow_file_mgr.get_file?p_security_group_id=19526826517643043&p_flow_id=104&p_fname=redN.gif" alt="NATCA must submit this by 05/27/06"> </td>
Upload/download
Users upload and download documents associated with each grievance. The process is analogous to a legal case.
Upload/download: Custom tables
The custom tables are tied to individual grievances by the primary key GRID.
Upload: Javascript validation
Javascript restricts the length of the file name. Application Express will not accept more than 78 characters.
Download from custom table: Report
The SQL report region lists all stored files associated with the grievance whose primary key (GRID) is passed into :P27_GRID.
Download from custom table: Link
An automated column link uses the DOWNLOAD_MY_FILE procedure to make the File Name column a download link.
Note: DOWNLOAD_MY_FILE is available on OTN
PLSQL region: Sample code
if p_letterhead = 1 thenmsg := '<table width="90%" border="0"><tr><td width="50%" align="center"><img src = "#WORKSPACE_IMAGES#natca.gif"></td> <td><i><font size="4"> NATCA ‘ || p_facid || '</font></i><br><font size="3">‘ || p_fac_address || '</font></td></tr></table><br><br>';elsemsg := '<br><br><br><br><br><br><br><br><br>';end if;
msg := msg || to_char(p_date_sub, 'FMMonth dd, yyyy') || '<br><br>' || p_address || '<br><br>Grievance Number ' || nvl(gr_cursor.faanum, '______________________') || '<br><br><b>Re: Grievance Regarding ' || gr_cursor.topic || '</b><br><br>Dear ' || p_dear || ',<br><br>' || p_preamble || '<br><br><b>Name of Grievant: </b>' || gr_cursor.grievant || '<br><b>Name of Representative: </b>' || gr_cursor.rep || '<br><b>Date of Violation: </b>' || to_char(gr_cursor.violation_date, 'FMMonth dd, yyyy') || '<br><b>Request Oral Presentation: </b>' || p_oral_text;
htp.p(msg);
The following PLSQL code is used to create a form letter:
PLSQL region: CLOB data
for j in 1..trunc(DBMS_LOB.GETLENGTH(gr_cursor.nature)/3000) + 1 loopDBMS_LOB.READ(gr_cursor.nature, p_text_amt, p_text_pos, p_nature_sub);msg := replace(p_nature_sub, chr(10), '<br>');
if :F168_SEARCH is not null and :P9_HIGHLIGHT is not null thenmsg := replace(replace(replace(msg, :F168_SEARCH, '<SPAN style="background-color:yellow">' || :F168_SEARCH || '</span>'), initcap(:F168_SEARCH), '<SPAN style="background-color:yellow">' || initcap(:F168_SEARCH) || '</span>'), upper(:F168_SEARCH), '<SPAN style="background-color:yellow">' || upper(:F168_SEARCH) || '</span>');end if;
htp.p(msg);p_text_pos := p_text_pos + 3000;end loop;
This code is used to push CLOB text (gr_cursor.nature) onto the HTML page. Since this page may also be called from the Search page, code is included to highlight search words.
Automatic row processing
Row processing can be handled automatically by the ApEx engine. This provides optimistic locking behind the scenes without input from the developer.
Manual row processing
for c1 in (select * from grievance where grid = :P8_GRID) loopcurrent_state := utl_raw.cast_to_raw(dbms_obfuscation_toolkit.md5(input_string => c1.FAANUM||c1.GRIEVANT||c1.REP||c1.TOPIC||c1.ORAL));end loop;if current_state = :P8_CHECKSUM thenselect empid into p_empid from gr_emp where upper(username) = :APP_USER;case :P8_GR_STATUSwhen 1 thenupdate grievance set faanum = :P8_FAANUM, rep = :P8_REP, topic = :P8_TOPIC, oral = :P8_ORAL where grid = :P8_GRID, userid = p_empid;:P8_RETURN_PAGE := 18;when 2 thenupdate grievance set faanum = :P8_FAANUM, rep = :P8_REP, topic = :P8_TOPIC, oral = :P8_ORAL where grid = :P8_GRID, userid = p_empid;:P8_RETURN_PAGE := 32;end case;else:P8_RETURN_PAGE := 39;end if;
:P8_CHECKSUM is calculated when the page is rendered. If it changes, the update does not execute.
Optimistic locking error
When the checksums do not agree, conditional processing prevents the update and conditional branching takes the user to this page.
Javascript
Javascript greatly enhances the functionality of the application and the experience of the user. Javascript can be included on individual pages or on a template.
Javascript: User tools
Sample javascript as it would appear in the page attributes is shown here. The first function opens a new window and the second populates a field based on a drop-down menu selection.
Javascript: Client validation
Since most browsers have a maximum content size of 32K, a graceful error message is needed should the user exceed that. This javascript provides a pop-up and halts processing.
Calling javascript
From a page button:
Manually in an SQL Report Region (with Session State Protection):select '<a href="javascript:myPopUp(''' || htmldb_util.prepare_URL('f?
p=&APP_ID.:9:' || :APP_SESSION || '::::P9_GRID:' || g.GRID) || ''')">' || g.topic || '</a>' "Topic“
from grievance g