apex plsql report regions and apps that build themselves
DESCRIPTION
ApEx PLSQL Report Regions and Apps that Build Themselves. Bill Holtzman and Steve Schreck National Air Traffic Controllers Association. NATCA. National Air Traffic Controllers Association Federal Aviation Administration employees Mountains of regulations and business rules - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: ApEx PLSQL Report Regions and Apps that Build Themselves](https://reader036.vdocuments.net/reader036/viewer/2022081511/568143d5550346895db062f2/html5/thumbnails/1.jpg)
1
ApEx PLSQL Report Regions
and
Apps that Build Themselves
Bill Holtzman and Steve Schreck
National Air Traffic Controllers Association
![Page 2: ApEx PLSQL Report Regions and Apps that Build Themselves](https://reader036.vdocuments.net/reader036/viewer/2022081511/568143d5550346895db062f2/html5/thumbnails/2.jpg)
22
NATCA
National Air Traffic Controllers Association• Federal Aviation Administration
employees• Mountains of regulations and business
rules• 400 US facilities• 15,000 members• 1000 Reps
![Page 3: ApEx PLSQL Report Regions and Apps that Build Themselves](https://reader036.vdocuments.net/reader036/viewer/2022081511/568143d5550346895db062f2/html5/thumbnails/3.jpg)
33
Air Traffic Control Display
![Page 4: ApEx PLSQL Report Regions and Apps that Build Themselves](https://reader036.vdocuments.net/reader036/viewer/2022081511/568143d5550346895db062f2/html5/thumbnails/4.jpg)
44
All US Flights
![Page 5: ApEx PLSQL Report Regions and Apps that Build Themselves](https://reader036.vdocuments.net/reader036/viewer/2022081511/568143d5550346895db062f2/html5/thumbnails/5.jpg)
55
Major Apps
Grievance Tracking: GATS– PLSQL generated SQL
report regions
Survey Tool: Survey Junkie– App creates new
pages, items, etc.
![Page 6: ApEx PLSQL Report Regions and Apps that Build Themselves](https://reader036.vdocuments.net/reader036/viewer/2022081511/568143d5550346895db062f2/html5/thumbnails/6.jpg)
6
Participate in the Demo
http://demo.natca.net
![Page 7: ApEx PLSQL Report Regions and Apps that Build Themselves](https://reader036.vdocuments.net/reader036/viewer/2022081511/568143d5550346895db062f2/html5/thumbnails/7.jpg)
77
Grievance Tracking
![Page 8: ApEx PLSQL Report Regions and Apps that Build Themselves](https://reader036.vdocuments.net/reader036/viewer/2022081511/568143d5550346895db062f2/html5/thumbnails/8.jpg)
88
Manual Column Link
select '<a href="' || apex_util.prepare_URL('f?p= &APP_ID.:8:' || :APP_SESSION || ':::8: P8_DUP_GRID,P8_RET_PAGE:' || g.grid || ',32') || '">' || g.natca || '</a><br /><span style="font-size:8pt">' || g.faanum || '</span>' "NATCA/FAA" from grievance g
target URL in blue – HTML link in red
![Page 9: ApEx PLSQL Report Regions and Apps that Build Themselves](https://reader036.vdocuments.net/reader036/viewer/2022081511/568143d5550346895db062f2/html5/thumbnails/9.jpg)
99
Manual Link with Javascript
select '<a href= "javascript:myPopUp(''' || apex_util.prepare_URL('f?p=&APP_ID.:9:' || :APP_SESSION || '::::P9_GRID:' || g.GRID) || ''')">' || g.topic || '</a>' “Grievance Regarding” from grievance g
![Page 10: ApEx PLSQL Report Regions and Apps that Build Themselves](https://reader036.vdocuments.net/reader036/viewer/2022081511/568143d5550346895db062f2/html5/thumbnails/10.jpg)
1010
Composite Data Column
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">'when (g.u_action_2 - sysdate) > 3 then '<img src = "#FLOW_IMAGES#yellowN.gif">'when (g.u_action_2 - sysdate) > 0 then '<img src = "#FLOW_IMAGES#redN.gif">'else '<img src="#FLOW_IMAGES#past.gif">'end,to_char(g.date_sub_2, 'MM/DD/YY')), 'Closed') "DATE_SUB"from grievance g
![Page 11: ApEx PLSQL Report Regions and Apps that Build Themselves](https://reader036.vdocuments.net/reader036/viewer/2022081511/568143d5550346895db062f2/html5/thumbnails/11.jpg)
1111
Sorting Issue
![Page 12: ApEx PLSQL Report Regions and Apps that Build Themselves](https://reader036.vdocuments.net/reader036/viewer/2022081511/568143d5550346895db062f2/html5/thumbnails/12.jpg)
1212
WHERE Clauseswhere g.gr_status = 2and g.status_id = p.idand ((g.faanum like '%'||:P32_FAANUM||'%' and :P32_FAANUM is not null)
or :P32_FAANUM is null)and ((:P32_FACILITY_ID != 0 and g.facility_id = :P32_FACILITY_ID) or
(:P32_FACILITY_ID = 0 and (g.facility_id in (select id from gr_facility_lookup where region_id = (select y.region_id from gr_facility_lookup y, gr_emp z where upper(z.username) = :APP_USER and z.facility_id = y.id)) or g.facility_id = 3)))
and (g.status_id = 1 or g.close_date > sysdate - :P32_DAYS)and ((g.date_sub_2 is not null and :P32_NF = 1) or (g.date_sub_2 is null
and :P32_NF = 2) or (:P32_NF = 0))and g.status_id != 2and (:P32_REP is null or lower(g.rep) like '%' || lower(:P32_REP) || '%')and (:P32_NATCA is null or upper(:P32_NATCA) = g.natca)and (:P32_GRIEVANT is null or upper(g.grievant) like '%'||
upper(:P32_GRIEVANT)||'%')and (:P32_TOPIC is null or lower(g.topic) like '%' || lower(:P32_TOPIC) ||
'%')order by g.status_id, trunc(g.reply_by_2), trunc(g.date_sub_2) nulls last,
trunc(g.u_action_2) nulls last, trunc(g.date_rec_1) nulls last, trunc(g.date_sub_1) nulls last, substr(g.natca,4,3), g.natcasub
![Page 13: ApEx PLSQL Report Regions and Apps that Build Themselves](https://reader036.vdocuments.net/reader036/viewer/2022081511/568143d5550346895db062f2/html5/thumbnails/13.jpg)
1313
Converting to PLSQL
declarep_sql varchar2(32767);beginp_sql := q'! select * from grievance where $P7_SHOW =
1 !';return replace(p_sql, '$', ':');end;
![Page 14: ApEx PLSQL Report Regions and Apps that Build Themselves](https://reader036.vdocuments.net/reader036/viewer/2022081511/568143d5550346895db062f2/html5/thumbnails/14.jpg)
1414
Stripping WHERE Clauses
declarep_sql varchar2(32767);beginp_sql := q'! select g.grid, !';p_sql := p_sql || q'! '<a href="javascript$myPopUp(''f?p=&APP_ID.$9$' || $APP_SESSION || '$$$$P9_GRID$' || g.grid || ''')">' || g.topic || '</a>' || gr_groupid(g.grid) "Topic“ !';p_sql := p_sql || q'! from grievance g, gr_status_lookup p, gr_bu b where g.gr_status = 3 and g.status_id = p.id and g.bu_id = b.id (+) !';if :P35_FAANUM is not null thenp_sql := p_sql || q'! and lower(g.faanum) like '%' || lower($P35_FAANUM) || '%' !';end if;return replace(p_sql,'$',':');end;
No user text = no where clause!
![Page 15: ApEx PLSQL Report Regions and Apps that Build Themselves](https://reader036.vdocuments.net/reader036/viewer/2022081511/568143d5550346895db062f2/html5/thumbnails/15.jpg)
1515
Complex Sorting w/PLSQLdeclarep_sql varchar2(32767);beginp_sql := q'! select g.GRID, !';p_sql := p_sql || q'! '<a href="javascript$myPopUp(''f?p=&APP_ID.$9$' || $APP_SESSION || '$$$$P9_GRID$' || g.GRID || ''')" &F168_PRINT.>' || g.topic || '</a>' || gr_groupid(g.grid) "Topic" !';p_sql := p_sql || q'! from grievance g, gr_status_lookup p, gr_bu b where g.gr_status = 3 and g.status_id = p.id and g.bu_id = b.id (+) !';casewhen :P35_SORT = 1 then p_sql := p_sql || q'! order by trunc(g.reply_by_3), trunc(g.date_sub_3) nulls last !';when :P35_SORT = 2 then p_sql := p_sql || q'! order by trunc(g.date_sub_3), trunc(g.u_action_3) nulls last !';else null;end case;return replace(p_sql,'$',':');end;
![Page 16: ApEx PLSQL Report Regions and Apps that Build Themselves](https://reader036.vdocuments.net/reader036/viewer/2022081511/568143d5550346895db062f2/html5/thumbnails/16.jpg)
1616
Result
![Page 17: ApEx PLSQL Report Regions and Apps that Build Themselves](https://reader036.vdocuments.net/reader036/viewer/2022081511/568143d5550346895db062f2/html5/thumbnails/17.jpg)
17
Database-driven Javascript
declarep_java varchar2(4000);cursor c1 is select bu_id, bplate from gr_bu;beginp_java := 'function insertBP(p_region_id) {var p_bu_id = document.getElementById("P8_BU_ID").value;';for a1 in c1 loopp_java := p_java || chr(10) || 'if (p_bu_id == ' || a1.bu_id || ')' || chr(10) || 'document.getElementById("P8_BPLATE").value = "' || a1.bplate || '";';end loop;p_java := p_java || chr(10) || '}';:F168_BPLATE_JAVA := p_java;end;
![Page 18: ApEx PLSQL Report Regions and Apps that Build Themselves](https://reader036.vdocuments.net/reader036/viewer/2022081511/568143d5550346895db062f2/html5/thumbnails/18.jpg)
1818
Apps that Build Themselves
![Page 19: ApEx PLSQL Report Regions and Apps that Build Themselves](https://reader036.vdocuments.net/reader036/viewer/2022081511/568143d5550346895db062f2/html5/thumbnails/19.jpg)
1919
Subscription Tools
![Page 20: ApEx PLSQL Report Regions and Apps that Build Themselves](https://reader036.vdocuments.net/reader036/viewer/2022081511/568143d5550346895db062f2/html5/thumbnails/20.jpg)
2020
In-house Advantages
• Direct integration with internal database
• Information stays on your server• App can be customized for future
needs• No reliance on outside support
![Page 21: ApEx PLSQL Report Regions and Apps that Build Themselves](https://reader036.vdocuments.net/reader036/viewer/2022081511/568143d5550346895db062f2/html5/thumbnails/21.jpg)
2121
Concept Development
• Individual survey construction?• Substitute user-supplied questions
into existing item labels and user-supplied answers into Select Lists?
![Page 22: ApEx PLSQL Report Regions and Apps that Build Themselves](https://reader036.vdocuments.net/reader036/viewer/2022081511/568143d5550346895db062f2/html5/thumbnails/22.jpg)
2222
Export File Components
wwv_flow_api.create_page_item( p_id =>7422425059996976 + wwv_flow_api.g_id_offset, p_flow_id => wwv_flow.g_flow_id, p_flow_step_id => 1, p_name =>'P1_DEMO', p_display_as => 'RADIOGROUP', p_item_sequence => 10, p_item_plug_id => 7401108705976868+wwv_flow_api.g_id_offset, p_begin_on_new_line => 'YES', p_begin_on_new_field => 'YES', p_colspan => 1, p_rowspan => 1, -- etc.) wwv_flow_id.next_val
![Page 23: ApEx PLSQL Report Regions and Apps that Build Themselves](https://reader036.vdocuments.net/reader036/viewer/2022081511/568143d5550346895db062f2/html5/thumbnails/23.jpg)
2323
The Question
Can we use ApEx’ own export code to create ApEx objects from within an app?
![Page 24: ApEx PLSQL Report Regions and Apps that Build Themselves](https://reader036.vdocuments.net/reader036/viewer/2022081511/568143d5550346895db062f2/html5/thumbnails/24.jpg)
2424
Concept
Demo
![Page 25: ApEx PLSQL Report Regions and Apps that Build Themselves](https://reader036.vdocuments.net/reader036/viewer/2022081511/568143d5550346895db062f2/html5/thumbnails/25.jpg)
25
Online Demo
![Page 26: ApEx PLSQL Report Regions and Apps that Build Themselves](https://reader036.vdocuments.net/reader036/viewer/2022081511/568143d5550346895db062f2/html5/thumbnails/26.jpg)
26
Caveats
• Use of wwv_flow_api not specifically supported by Oracle
• Do not over-write your app in PROD!
• The app cannot in some cases be imported successfully.
![Page 28: ApEx PLSQL Report Regions and Apps that Build Themselves](https://reader036.vdocuments.net/reader036/viewer/2022081511/568143d5550346895db062f2/html5/thumbnails/28.jpg)
28