Oracle Application Express Cheat Sheet
-
Upload
srinivasbollapalli -
Category
Documents
-
view
560 -
download
16
Transcript of Oracle Application Express Cheat Sheet
![Page 2: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/2.jpg)
Cannell
About Me …(Speaker Qualifications)
Karen Cannell ~ Principal
Analyzed, designed developed, converted, upgraded, enhanced and otherwise worked on database applications for 20+ years, focused on Oracle since 1994. Currently migrating business processes from paper to web-based systems, leveraging the Oracle 9i and 10g suite of tools. Lately APEX, Discoverer upgrades.
VOLUNTEER for IOUG, ODTUG, Oracle Magazine. ODTUG Journal Sr. Technical Editor
Volunteer to author ODTUG Journal Articles!!
Using APEX since the HTMLDB beginning
2
www.odtug.com
![Page 3: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/3.jpg)
Cannell
About You … (Audience Background)
New to APEX?APEX Experience?Previous Tools?
APEX Training?Version 3.1?
3
www.odtug.com
![Page 4: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/4.jpg)
Cannell
Session Objectives
Learn APEX syntax; Know what to use when and whereLearn common tricks to customize APEX to your needsAccelerate your APEX learning curve
NOT an APEX How-To Session …NOT an Advanced APEX Session …
4
www.odtug.com
![Page 5: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/5.jpg)
Cannell
Why an APEX Cheat Sheet?
APEX is a blend of technologies …A “Rapid Application Development” tool
Lots of syntax .. Syntax sensitive ..Lots of wizards …Wizards are OK, defaults are OK, but we need more …Mix of languages: HTML, PL/SQL, JavaScript, XML ..
We don’t intuitively know everything!
5
www.odtug.com
![Page 6: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/6.jpg)
Cannell
What we’ll Cover:
f?p syntaxLearning from APEX
CaseReferencing Items
& . #...# V and NVItem Types, Positions, Defaults Layout Control
Page RegionRegion TemplatesAlignment
Customizations
ValidationAPEXJavaScript
Report tipsEdit LinkEmbed Link in Query
Popup WindowsSending MailCustom AuthenticationReferences
6
www.odtug.com
![Page 7: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/7.jpg)
Cannell
APEX 30-second Intro
Part of Database – Fully SupportedBrowser-based – no client installHTTP Server Rapid Web Development ToolDeclarative ProgrammingWizards Wizards WizardsAll Applications are HTML - no applet downloads
7
www.odtug.com
![Page 8: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/8.jpg)
Cannell
Application BuilderSQL WorkshopUtilities
8
www.odtug.com
![Page 9: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/9.jpg)
Quick APEX Demo ?
APEX Demonstration
9
www.odtug.com
![Page 10: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/10.jpg)
Cannell
f?p Syntax
URL Reference to an APEX pageAll APEX pages are f?p calls
Two Parts:Path to Server:
http://<hostname>:<port>/apex/pls/...
Call to PL/SQL Procedure F with Parameter P…/f?p=<AppId:Page:Session:Request:Debug:ClearCache:
Item Name:Value(s):PrinterFriendly>
10
www.odtug.com
![Page 11: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/11.jpg)
Cannell
http://hostname:port/pls/ape x/
f?p=4000:4001:<session id>::NO:4001:FB_FLOW_ID:700
f?p URL
11
www.odtug.com
![Page 12: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/12.jpg)
Cannell
f?p Part 1: Address to APEX Server
http://<hostname>:<port>/pls/apex/...
http:// hostname Host name:port Port number, usually 7777, 7778,
7779/pls Path to modplsql/apex Name of the PL/SQL DAD used in
APEX configuration. Apex is the default per configuration guide
12
www.odtug.com
![Page 13: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/13.jpg)
Cannell
f?p Part 2: F Call and P Parameter
F is an APEX PL/SQL procedure that renders APEX pagesSingle parameter PP is a concatenation of 9 arguments:
AppId :Page :Session :Request :Debug :ClearCache :Items :Values :PrinterFriendly
f?p=4000:4001:<session id>::NO:4001:FB_FLOW_ID:700
13
www.odtug.com
![Page 14: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/14.jpg)
Cannell
f?p: parameter P argsArgument Definition Usage
App Id Application identifier or alias APP_ID, APP_ALIAS
Page Page number or alias Page number or alias, or use APP_PAGE_ID to reference the current page
Session Session identifier APP_SESSION or SESSION
Request HTTP page request The actual request: GO SAVE, ADD.
Debug Debug flag YES, NO or DEBUG
Clear Cache Clear cache for the listed page(s) Page numbers or page alias, or APP to clear all
Item Name(s) Item names to pass to the page P1_ITEM, P2_ITEM
Item Value(s) Item values to correspond to item names
:P1_ITEM, :P2_ITEM or &P1_ITEM. &P2_ITEM.
Printer Friendly Printer Friendly flag YES, NO or PRINTER_FRIENDLY
14
www.odtug.com
![Page 15: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/15.jpg)
Cannell
f?p P Parameter String
Arguments Must be In OrderColon : to Separate ArgumentsCan Omit Arguments – will DefaultUse : to Maintain PositionIf All Remaining Args are Default, can Omitf?p=550::::::
15
www.odtug.com
![Page 16: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/16.jpg)
Cannell
P = string of arguments
f?p=
AppId : Page : Session : Request :Debug : ClearCache : ItemNames : Values : PrinterFriendly
All Programmers Smartly Request Double Cash In Virtual Programs
16
www.odtug.com
![Page 17: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/17.jpg)
Cannell
f?p Examples
Part of a URL:http://tunahuntress.tunahunter.com:7777/pls/apex/f?p=710:6:361726
3641284922::NO::P6_COMMITTEE_CODE:459
Translates to:Render page 6 of application 710 for the current session, no debug,
using 459 as the value of P6_COMMITTEE_CODE
and looks like …
17
www.odtug.com
![Page 18: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/18.jpg)
Cannell
18
www.odtug.com
![Page 19: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/19.jpg)
Cannell
f?p Example – APEX URL Target
In HTML, as in an APEX URL Target:
<a href=”f?p=(&APP_ID.:12:&APP_SESSION.::NO::P12_COMMITTEE_C
ODE, P12_COMMITTEE_NAME:&P10_COMMITTEE_CODE., &P10_COMMITTEE_NAME.)”>
A link to the current app, page 12, the current session, no debug, setting p12_committee_code and p12_committee_name with the values of p10_committee_code and p10_committee_name.
19
www.odtug.com
![Page 20: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/20.jpg)
Cannell
f?p Example – APEX URL Target
Javascript PopupURL
javascript:popupURL('f?p=&APP_ID.:46: &APP_SESSION.::NO::P46_MEMBERID: &P44_MEMBERID.');
20
www.odtug.com
![Page 21: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/21.jpg)
Learn APEX from APEX
APEX Import UtilityImport <APEX install dir>/builder/f4000.sql (f4050.sql,f4155.sql,f4300.sql,f4411.sql …)
On Install:Renumber AppChange Alias
Inspect Only (Cannot run)
21
www.odtug.com
![Page 22: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/22.jpg)
Cannell
About CASE … APEX is picky
APEX passwords ARE case sensitive!APEX item names work in either case, uppercase or lower.Reference to substitution strings should be in UPPERCASE
:APP_ID &SESSION. PRINTER_FRIENDLY.
Button name references should match case
22
www.odtug.com
![Page 23: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/23.jpg)
Cannell
Referencing Items – 6 ways!
Bind Variable :P1_ITEMSubstitution String &P1_ITEM.PL/SQL value function V(‘P1_ITEM’) or NV(‘P1_ITEM’)Direct PL/SQL APEX_APPLICATION.G_FLOW_IDTemplate Substitution
#P1_ITEM#
23
www.odtug.com
![Page 24: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/24.jpg)
Cannell
Bind Variable
:P1_ITEMWithin SQL, PL/SQL, Page Processes, Validations, Computations
Most frequently used
24
www.odtug.com
![Page 25: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/25.jpg)
Cannell
Substitution
&P1_ITEM.Use in APEX element, f?p and HTML references
25
www.odtug.com
![Page 26: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/26.jpg)
Cannell
Substitution Syntax - Example
In the Messages Dialog of a Process:
… Demo Email sent to &P2_EMAILADDRESS.
26
www.odtug.com
![Page 27: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/27.jpg)
Cannell
V and NV Functions
V(‘P1_ITEM’) and NV(‘P1_NUMBER’)Use within PL/SQL modulesCurrent session only
Do not work in spawned/background jobs
27
www.odtug.com
![Page 28: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/28.jpg)
Cannell
V and NV Caution
Not DETERMINISTICPotential Performance ImpactSELECT x,y,z FROM abc WHERE x = V(‘P1_ITEM’)Executes once for each row of abc
Wrapper for V and NV – Drop-in “replacement” available from Inside-Apex Blog at:http://inside-apex.blogspot.com/2006/12/drop-in-replacement-for- v-and-nv.html
thanks Patrick!
28
www.odtug.com
![Page 29: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/29.jpg)
Cannell
Template Substitution
#P1_ITEM#Page, Region and Report TemplatesUse to customize your own templatesBe aware of #...# to understand APEX templates, button, nav bar, default region placement
29
www.odtug.com
![Page 30: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/30.jpg)
Cannell
Template Substitution - Example
Template Substitution - default placement for Region
Buttons
<table class="t12FormRegion" id="#REGION_ID#" summary=""><tr><td class="t12Header">#TITLE#</td></tr><tr><td class="t12ButtonHolder">#CLOSE##PREVIOUS##NEXT##DELETE##EDI T##CHANGE##CREATE##HELP#</td></tr><tr><td class="t12Body">#BODY#</td></tr><tr><td><img src="#IMAGE_PREFIX#themes/theme_12/t.gif" width="400" height="1"></td></tr></table>
30
www.odtug.com
![Page 31: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/31.jpg)
Cannell
Direct
APEX_APPLICATION.G_<name>Used in PL/SQL, similar to V and NVCurrent session only
Do not work in spawned/background jobs
31
www.odtug.com
![Page 32: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/32.jpg)
Cannell
What to Use When
:Bind variables in SQL, Page Processes, Validations, Computations&__. Substitution In HTMLV and NV or APEX_APPLICATION in PL/SQL #TEMPLATE# in page, region, report and other templates.
32
www.odtug.com
![Page 33: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/33.jpg)
Cannell
Syntax Examples
HTML anchor in Header, Footer or HTML Region:<a href=”f?p=&APP_ALIAS.:4:&APP_SESSION.>”Click here for Page 4</a>
PL/SQL htf.anchor:htf.anchor(‘f?p=’||APEX_APPLICATION.G_FLOW_ID||’:4:’||V(‘APP_SESSION’),’Click
for Page 4’);orhtf.anchor(‘f?p=’||V(‘APP_ID’)||’:4:’||V(‘APP_SESSION’),’Click for Page 4’);
Anchor in a SQL Query:SELECT ‘<a href=“f?p=’||:APP_ID||’:4:'||:APP_SESSION||’>Click for Page 4</a>’
FROM DUAL;
33
www.odtug.com
![Page 34: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/34.jpg)
Cannell
Item Type, Position and Default
Item TypesPosition OptionsUser Interface Defaults
Know the Defaults ... Then Know How to Adjust
34
www.odtug.com
![Page 35: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/35.jpg)
Cannell
Item Types –APEX defaults
35
www.odtug.com
![Page 36: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/36.jpg)
Cannell
Some Different Item Types
File BrowseMulti SelectShuttleStop/Start TableText Area … w/Counter, Spellcheck, HTML Editor
36
www.odtug.com
![Page 37: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/37.jpg)
Cannell
Advanced Item Types
37
www.odtug.com
![Page 38: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/38.jpg)
Cannell
Item Position Settings
Use the Displayed settings to adjust item placement relative to other items on the page
New Line NoField NoColSpan 1 RowSpan 1
New Line YesField YesColSpan 1 RowSpan 1
38
www.odtug.com
![Page 39: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/39.jpg)
Cannell
Drag and Drop Item Layout
Access from Items element
39
www.odtug.com
![Page 40: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/40.jpg)
Cannell
Drag and Drop Item Interface
40
www.odtug.com
![Page 41: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/41.jpg)
Cannell
User Interface Defaults
Use them! Tedious now or later.Shared Components User Interface User Interface DefaultsBy Table or ViewDefines Defaults for Reports and FormsGrid or Individual Element Access
41
www.odtug.com
![Page 42: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/42.jpg)
Cannell
User Interface Defaults
42
www.odtug.com
![Page 43: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/43.jpg)
Cannell
Layout Control
Page RegionRegion Templates
Know the Defaults ... Then Know How to Adjust
43
www.odtug.com
![Page 44: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/44.jpg)
Cannell
Page Regions
Will vary slightlyfrom theme to theme
Region Positionfor Sidebar
Note templateSubstitution Strings
If you don’t like it …Edit the Template!
paper #447
44
www.odtug.com
![Page 45: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/45.jpg)
Cannell
Region Templates
Will vary slightly from theme to theme
Edit as you like
45
www.odtug.com
![Page 46: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/46.jpg)
Cannell
Region Templates
alt. theme
paper #447
46
www.odtug.com
![Page 47: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/47.jpg)
Cannell
Forcing Alignment
RegionsSpecifically set Height and Width
<table height=”400” width=”400”><tr><td>
and close with</td></tr></table>
Use a Spacer image to force height or width<img src="#IMAGE_PREFIX#/1px_trans.gif" width="355"
height="0">
47
www.odtug.com
![Page 48: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/48.jpg)
Cannell
Forcing Region Alignment
Spacer (pixel) image in header, footer, source
Img src=#IMAGE_PREFIX#/1px_trans.gif width =“355” height=“0”>
48
www.odtug.com
![Page 49: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/49.jpg)
Cannell
49
www.odtug.com
![Page 50: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/50.jpg)
Cannell
Forcing Item Alignment
Use the HTML Form Element Attributes field:Select Listsstyle=“width:80;”
Form Fieldsstyle=“width:80;”
Set other Item attributes:style=”text-transform:uppercase;”onFocus=”javascript:this.maxlength=30;”
50
www.odtug.com
![Page 51: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/51.jpg)
Cannell
Force Item Alignment, Attributes
Text Area: Set height, width, a scrollbar and force the data to Uppercase
style="font-family:Arial;font-size:10px; height:50px;width:300px;overflow:auto;" onBlur="javascript:{this.value = this.value.toUpperCase(); }"
51
www.odtug.com
![Page 52: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/52.jpg)
Cannell
Customizations
Header LogoCorporate Interface / Look-and-Feel
52
www.odtug.com
![Page 53: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/53.jpg)
Cannell
Header Logo or Text
Application Edit Attributes Definition Logo.
53
www.odtug.com
![Page 54: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/54.jpg)
Cannell
Corporate User Interface
Yes, Is DoableBest Reference: Cloning your Corporate UI with HTML DB blog series
at http://www.orablogs.com/scott/archives/001189.html Scott Spendolini
My Experience: 1 Hour to “Useable”, 4+ for all page templates complete with substitution tagsAdvice: Go for It … weighing costs, of course.
54
www.odtug.com
![Page 55: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/55.jpg)
Cannell
To Change Default Templates
Application Shared Components Themes Create/Edit ThemeHere can edit all default templates
55
www.odtug.com
![Page 56: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/56.jpg)
Cannellpaper #447
56
www.odtug.com
![Page 57: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/57.jpg)
Cannell
Validations
APEXJavaScript
57
www.odtug.com
![Page 58: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/58.jpg)
Cannell
Validations - APEX
Item or Page LevelNOT NULL, String Comp, Reg Exp, SQL, PL/SQL
58
www.odtug.com
![Page 59: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/59.jpg)
Cannell
Validations - JavaScript
In HTML Form Element Attributes field
Not a JavaScript wiz? Search online …
59
www.odtug.com
![Page 60: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/60.jpg)
Cannell
JavaScript Example - SSN
In HTML Form Element Attributes:
onBlur="javascript:SSNValidation(this.value);“
Function goes in the Page Header, or, in an include file that contains all the JavaScript for the page.
60
www.odtug.com
![Page 61: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/61.jpg)
Cannell
JavaScript – function in Header
function SSNValidation(ssn) {var matchArr = ssn.match(/^(\d{3})-?\d{2}-?\d{4}$/);var numDashes = ssn.split('-').length - 1;if (matchArr == null || numDashes == 1) {
alert('Invalid SSN. Must be 9 digits or in the form NNN- NN-NNNN.');msg = "does not appear to be valid";
}else if (parseInt(matchArr[1],10)==0) {
alert("Invalid SSN: SSN's can't start with 000.");msg = "does not appear to be valid";
} }
61
www.odtug.com
![Page 62: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/62.jpg)
Cannell
Reports
Edit LinkURL(f?p) in SQL QueryInteractive Reports (3.1)
62
www.odtug.com
![Page 63: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/63.jpg)
Cannell
Report – Edit Link
Report Region Region Attributes Column Link
63
www.odtug.com
![Page 64: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/64.jpg)
Cannell
Embed Link in SQL Query - example
Embed a link in SQL QuerySELECT ‘http://www.ioug.org/open_link.cfm?’ OPEN, MEMBER_ID, LAST_NAME, …
SELECT “f?p( …)” PLINK, MEMBER_ID, LAST_NAME, …
The link is now part of your report. Too Simple!
64
www.odtug.com
![Page 65: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/65.jpg)
Cannell
Interactive Reports
Includes a Select Bar and an Action BarSettings are Options in Report Attributes
65
www.odtug.com
![Page 66: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/66.jpg)
Cannell
Action BarSelect
Dropdown
Link to Single Row
Page
Custom Edit Button
(in Query, not part of
IR)
66
www.odtug.com
![Page 67: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/67.jpg)
Cannell
Interactive Reports - Limitations
Single TemplateCustomize by CSS only (no template edits)
One IR per pageCannot be an Updateable Report
67
www.odtug.com
![Page 68: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/68.jpg)
Cannell
Popup Options
APEX JavaScript built-in popupURLjavascript:popupURL('f?p=&APP_ID.:46:&SESSION.:: NO::P46_MEMBERID:&P44_MEMBERID.');
Build Custom Popup PageOTN APEX How-To Build Custom Popup Pages
http://www.oracle.com/technology/products/database/ application_express/howtos/how_to_create_custom _popups.html
68
www.odtug.com
![Page 69: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/69.jpg)
Cannell
Build Custom Popup - steps
Build Calling Form PageBuild Popup PageAdd JavaScript to call the Popup Page, passing values as neededAdd Popup Link or ButtonAdd JavaScript to Popup Page to pass values back
See the How-To for Syntax details!
69
www.odtug.com
![Page 70: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/70.jpg)
Cannell
Sending Email
Configure Email Server SettingsHTMLDB_MAIL packageHMTLDB_MAIL.SENDHTMLDB_MAIL.PUSH_QUEUE
70
www.odtug.com
![Page 71: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/71.jpg)
Cannell
Environment Settings SMTP Mail Server
Set by the APEX Administrator for the installation
71
www.odtug.com
![Page 72: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/72.jpg)
Cannell
APEX_MAIL.SEND
APEX_MAIL.SEND ( p_to IN VARCHAR2,p_from IN VARCHAR2,p_body IN VARCHAR2 | CLOB,p_body_html IN VARCHAR2 | CLOB,p_subj IN VARCHAR2 DEFAULT NULL,p_cc IN VARCHAR2 DEFAULT NULL,p_bcc IN VARCHAR2 DEFAULT NULL);
72
www.odtug.com
![Page 73: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/73.jpg)
Cannell
APEX_MAIL.SEND - Function
v_mail_id := APEX_MAIL.SEND ( p_to IN VARCHAR2,p_from IN VARCHAR2,p_body IN VARCHAR2 | CLOB,p_body_html IN VARCHAR2 | CLOB,p_subj IN VARCHAR2 DEFAULT NULL,p_cc IN VARCHAR2 DEFAULT NULL,p_bcc IN VARCHAR2 DEFAULT NULL);
73
www.odtug.com
![Page 74: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/74.jpg)
Cannell
APEX_MAIL - Example
DECLAREl_body_html varchar2(4000);lv_tolist varchar2( 2000) := ‘[email protected]’;
BEGINl_body_html := '<p> ‘||‘To view matching KALEIDOSCOPE Contacts click the link: </p>'||'<a href="http://tunahuntress.tunahunter.com:7777’||'/f?p=550:33:::::’||'P33_REPORT_SEARCH:'||:P1_LAST||'">View KALEIDOSCOPE Contacts</a></p>';
APEX_MAIL.SEND(P_TO => lv_tolist,P_FROM => :P1_EMAIL,P_BODY => l_body_html,P_BODY_HTML => l_body_html,P_SUBJ => 'New Mail Message from APEX’;
END;
DECLAREl_body_html varchar2(4000);lv_tolist varchar2( 2000) := ‘[email protected]’;
BEGINl_body_html := '<p> ‘||‘To view matching KALEIDOSCOPE Contacts click the link: </p>'||'<a href="http://tunahuntress.tunahunter.com:7777’||'/f?p=550:33:::::’||'P33_REPORT_SEARCH:'||:P1_LAST||'">View KALEIDOSCOPE Contacts</a></p>';
APEX_MAIL.SEND(P_TO => lv_tolist,P_FROM => :P1_EMAIL,P_BODY => l_body_html,P_BODY_HTML => l_body_html,P_SUBJ => 'New Mail Message from APEX’;
END;
DECLAREl_body_html varchar2(4000);lv_tolist varchar2( 2000) := ‘[email protected]’;
BEGINl_body_html := '<p> ‘||‘To view matching KALEIDOSCOPE Contacts click the link: </p>'||'<a href="http://tunahuntress.tunahunter.com:7777’||'/f?p=550:33:::::’||'P33_REPORT_SEARCH:'||:P1_LAST||'">View KALEIDOSCOPE Contacts</a></p>';
APEX_MAIL.SEND(P_TO => lv_tolist,P_FROM => :P1_EMAIL,P_BODY => l_body_html,P_BODY_HTML => l_body_html,P_SUBJ => 'New Mail Message from APEX’;
END;
74
www.odtug.com
![Page 75: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/75.jpg)
Cannell
APEX_MAIL.PUSH_QUEUE
Mail Queue “Sent” – Pushed – every 10 min.PUSH_QUEUE to send immediately
APEX_MAIL.PUSH_QUEUE( p_smtp_hostname IN VARCHAR2 DEFAULT,p_smtp_portno IN NUMBER DEFAULT);
APEX_MAIL.PUSH_QUEUE;
Useful for Debugging – No Wait
75
www.odtug.com
![Page 76: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/76.jpg)
Cannell
APEX Mail Attachments
Not possible via APEX_MAIL til APEX 3.1Can do via UTL_SMTP or Java Stored ProcedureSee OTN APEX Forum thread http://forums.oracle.com/forums/thread.jspa?message
ID=1383936
76
www.odtug.com
![Page 77: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/77.jpg)
Cannell
APEX_MAIL.ADD_ATTACHMENT
APEX_MAIL.ADD_ATTACHMENT( p_mail_id IN NUMBER, p_attachment IN BLOB, p_filename IN VARCHAR2, p_mime_type IN VARCHAR2);
Use function version of APEX_MAIL.SEND to return a mail id.Query filename from APEX_APPLICATION_FILESAdd multiple attachments by multiple ADD_ATTACHMENT calls
77
www.odtug.com
![Page 78: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/78.jpg)
Cannell
APEX Mail Attachments - ExampleDECLARE l_id number;
BEGIN l_id := APEX_MAIL.SEND(
p_to => '[email protected]', p_from => '[email protected]', p_subj => 'APEX_MAIL with attachment', p_body => 'Please review the attachment.', p_body_html => '<b>Please</b> review the attachment' );
FOR c1 IN (SELECT filename, blob_content, mime_type FROM APEX_APPLICATION_FILES WHERE ID IN (123,456)) loop --APEX_MAIL.ADD_ATTACHMENT( p_mail_id => l_id, p_attachment => c1.blob_content, p_filename => c1.filename, p_mime_type => c1.mime_type);
END LOOP; COMMIT; END;
Example from APEX User Guide
78
www.odtug.com
![Page 79: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/79.jpg)
Cannell
Custom Authentication
Custom Authentication WizardMost defaults are OK
Page Sentry function (here or redirect?)
Session Verify function (valid session?)
Invalid Session Target (where to go if failed login)
Pre-Authentication (cookies? audits?)
Authentication Process …
79
www.odtug.com
![Page 80: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/80.jpg)
Cannell
Custom Authentication, cont’d
Authentication Process: Boolean function2 parameters: Username, Password
return authenticate_kaleidoscope_user;NO arguments in the call!
80
www.odtug.com
![Page 81: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/81.jpg)
Cannell
Final Words …
SAVE OFTENApply ChangesBusiness Logic in PackagesExport Periodically (a simple backup!)
Apply Sound Development Practices
81
www.odtug.com
![Page 82: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/82.jpg)
Cannell
APEX Resources
APEX Forumhttp://forums.oracle.com/forums/forum.jspa?forumID=137
APEX Studiohttp://apex.oracle.com/i/index.html
APEX OTN Technology Center http://www.oracle.com/technology/products/database/application_e xpress/index.html
Oracle Metalinkhttp://metalink.oracle.com
82
www.odtug.com
![Page 83: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/83.jpg)
Cannell
APEX Resources, cont’dBlogs, Blogs and More Blogs …
Scott Spendolini: http://spendolini.blogspot.com and the older http://blogs.oracle/com/scott
Carl Backstrom: http://carlback.blogspot.com
APEX Blogs …John Scott, http://jes.blogs.shellprompt.net/Dimitri Gielis, http://dgielis.blogspot.com/Mark Swetz http://marcsewtz.blogspot.com/index.htmlDenes Kubicek, http://deneskubicek.blogspot.com/Dietmar Aust, http://daust.blogspot.com/Patrick Wolf – Inside APEX. http://inside-apex.blogspot.com and the ApexLib add-on
at http://apexlib.sourceforge.netand more blogs off of these!
Many thanks to Mike ,Joel ,Raj, David
83
www.odtug.com
![Page 84: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/84.jpg)
Cannell
APEX Resources, cont’d
TextbooksOracle HTMLDB Handbook, Develop and Deploy Fast, Secure Web Applications by Bradley Brown, Lawrence Linnemeyer, Oracle Press, 2006.Easy Oracle HTML-DB, Create Dynamic Web Pages with Oracle by Michael Cunningham and Kent Crotty, Rampant Press, 2006.
Pro Application Express by John Scott, Scott Spendolini Coming Soon!
84
www.odtug.com
![Page 85: Oracle Application Express Cheat Sheet](https://reader031.fdocuments.in/reader031/viewer/2022012306/544b0c41b1af9f784f8b4c99/html5/thumbnails/85.jpg)
Cannell
Share Your Knowledge ! Call for Articles/Reviewers
ODTUG Journal IOUG SELECT Journal
85
www.odtug.com