Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Application Express - A web development environment for the masses - and for serious application development

Application express has been enthusiastically adopted by many clients as a tool for the rapid development of database centric web applications. This presentation discusses some of the techniques used to develop Apex applications. It provides guidelines on best practices and includes the initial steps that should be considered when embarking on an Apex development. The presentation includes a look at development techniques for the 2.2 version, and a preview of some of the features that are available in version 3.0.

  • Be the first to comment

Application Express - A web development environment for the masses - and for serious application development

  1. 1. www.sagecomputing.com.auwww.sagecomputing.com.au Application ExpressApplication Express –– aa Development Environment for theDevelopment Environment for the MassesMasses Penny Cookson – Managing Director SAGE Computing ServicesSAGE Computing Services Customised Oracle Training WorkshopsCustomised Oracle Training Workshops and Consultingand Consulting www.sagecomputing.com.auwww.sagecomputing.com.au
  2. 2. www.sagecomputing.com.auwww.sagecomputing.com.au Why Apex? Embarking on an Apex development Best practices Apex development techniques Developing Apex for PDA Using Apex in Oracle XE What’s new in version 3.0 AgendaAgenda
  3. 3. www.sagecomputing.com.auwww.sagecomputing.com.au Why Apex?Why Apex? Wizard driven development environment Entirely within the Oracle database Declarative approach Meta data generated HTML pages Targeted at hosted small-medium systems development Uses traditional skills Rapid development Independent workspace Data where it belongs
  4. 4. www.sagecomputing.com.auwww.sagecomputing.com.au Its easy (but not so easy you’ll lose your job) Its fast (so quote fixed price not T and M) It uses your existing skills (and you thought you were obsolete) You don’t have to learn Java (So you can have a life) It looks quite reasonable (How would I know, I’m a developer) You don’t need to buy App Server (So you can afford a life) Why Apex?Why Apex?
  5. 5. www.sagecomputing.com.auwww.sagecomputing.com.au Environments Workspace rules Themes and templates Inheritance Standards Embarking on an ApexEmbarking on an Apex DevelopmentDevelopment or maybe just dive in and build it
  6. 6. www.sagecomputing.com.auwww.sagecomputing.com.au EnvironmentsEnvironments Do we need a development environment? Should we just build in production? What controls should we have in place? Should we (can we?) enforce standards on developers
  7. 7. www.sagecomputing.com.auwww.sagecomputing.com.au Single User ApplicationsSingle User Applications Used by one individual Access data for which a single individual is the custodian Tables will be created specifically to support the application No references or links to data used in corporate applicationsDeveloped using products such as MS Access in the past Consider development in production environment Enforce minimum controls
  8. 8. www.sagecomputing.com.auwww.sagecomputing.com.au Multi User ApplicationsMulti User Applications Used by multiple users Access data which is used by major corporate applications or which is of critical importance to the organisation Sufficient controls to ensure the integrity of the organisation’s data and processing Developed using products such as Oracle Forms in the past Data may contain references or links to data used in corporate applications System development methodology similar to that used for the development of significant applications Separate development environment
  9. 9. www.sagecomputing.com.auwww.sagecomputing.com.au WorkspacesWorkspaces Create a workspace for each business area Each workspace can have multiple applications Apex administrator allocates workspace manager Workspace manager creates developers and users Objects cannot easily be shared across workspaces Users are not shared across workspaces Its all mine, no-one else can mess with it
  10. 10. www.sagecomputing.com.auwww.sagecomputing.com.au Themes and TemplatesThemes and Templates Organisation theme files/images in file system Developers have no access and cannot apply their poor artistic skills to it Templates reference custom theme files/images in Apex repository Developers have access
  11. 11. www.sagecomputing.com.auwww.sagecomputing.com.au Setting up ThemesSetting up Themes Copy the theme directory that most closely matches your requirements
  12. 12. www.sagecomputing.com.auwww.sagecomputing.com.au Setting up ThemesSetting up Themes Replace all theme names in theme_V2.css
  13. 13. www.sagecomputing.com.auwww.sagecomputing.com.au Setting up ThemesSetting up Themes Create STANDARD_APP based on the Theme that most closely matches your requirements (theme_10 in the example) Export theme Import as new theme Switch to new theme and change name to sage Delete old theme Export the application to a file Replace all style names (t10 with sage) Replace all template names (theme_10 with sagetheme) Reimport the application Make any modifications to the templates and theme file
  14. 14. www.sagecomputing.com.auwww.sagecomputing.com.au Replace Theme and StyleReplace Theme and Style NamesNames
  15. 15. www.sagecomputing.com.auwww.sagecomputing.com.au Replace Theme and StyleReplace Theme and Style NamesNames
  16. 16. www.sagecomputing.com.auwww.sagecomputing.com.au Custom filesCustom files Create a custom .css and custom.js file Load them into Apex Reference them from your templates
  17. 17. www.sagecomputing.com.auwww.sagecomputing.com.au Best Practices
  18. 18. www.sagecomputing.com.auwww.sagecomputing.com.au InheritanceInheritance –– What we wantWhat we want STANDARD_APP Standard Workspace APP1 Workspace 1 Subscribe APP2 APP3 Workspace 2 APP4 Subscribe APP5 Workspace 3 APP6 Subscribe
  19. 19. www.sagecomputing.com.auwww.sagecomputing.com.au InheritanceInheritance -- RealisticallyRealistically For one Workspace STANDARD_APP contains common objects: Navigation bars LOVs Theme / Templates TEMPLATE_APP subscribes to the STANDARD_APP application Copy TEMPLATE_APP to create new applications STANDARD_APP TEMPLATE_APP Subscribe APP1 Copy Subscribe
  20. 20. www.sagecomputing.com.auwww.sagecomputing.com.au Backup/Change ControlBackup/Change Control Take an export of your application at regular intervals (because the dba won’t replace the whole database for a developer) Use Lock Page when working on a page Page 2 can only be changed by ADMIN
  21. 21. www.sagecomputing.com.auwww.sagecomputing.com.au Page LockingPage Locking When logged on as DEV1 only Cancel button displayed
  22. 22. www.sagecomputing.com.auwww.sagecomputing.com.au Primary KeysPrimary Keys Use artificial column as primary key Generate using trigger Apex allows for two part primary key >2 parts require hand crafting If primary key items are enterable you will need to disable them on update
  23. 23. www.sagecomputing.com.auwww.sagecomputing.com.au ImagesImages Images can be located in /i/ Referenced using #IMAGE_PREFIX# Images can be loaded into Apex repository as a shared object Reference using #WORKSPACE_IMAGES#filename Example: Application Logo
  24. 24. www.sagecomputing.com.auwww.sagecomputing.com.au Page URLSPage URLS f is a PL/SQL wrapper for wwv_flow.show f?p=App:Page:Session:Request:Debug:C learCache:itemNames:itemValues: PrinterFriendly Do not use hard coded APP_ID f?p=100:1:&SESSION. = WRONG f?p=&APP_ID.:1:&SESSION. = RIGHT
  25. 25. www.sagecomputing.com.auwww.sagecomputing.com.au UI DefaultsUI Defaults Specify normal display characteristics
  26. 26. www.sagecomputing.com.auwww.sagecomputing.com.au UI DefaultsUI Defaults Create for each table before building pages Set Report sequence Set Display As type for forms, tabular forms and reports Set Default Value Set Format Masks for dates Set Labels
  27. 27. www.sagecomputing.com.auwww.sagecomputing.com.au UI DefaultsUI Defaults -- DetailDetail Specify display characteristics Reports Forms Tabular Forms
  28. 28. www.sagecomputing.com.auwww.sagecomputing.com.au UI DefaultsUI Defaults -- LOVLOV Named LOV created when a wizard is used to create a form for the table LOV is named for the page that has been created e.g. P17_PARTIES_PAR_TYPE Multiple named LOV created Do not record LOV’s in UI Defaults Create a named LOV for each foreign key
  29. 29. www.sagecomputing.com.auwww.sagecomputing.com.au Page 0Page 0 Page 0 items appear on all pages Conditionally suppress when not required Use for objects common to multiple pages Navigation Task lists Contact details (so they call you next time they want some development) Copyright/Privacy text
  30. 30. www.sagecomputing.com.auwww.sagecomputing.com.au Page 0Page 0 –– NavigationNavigation MechanismsMechanisms
  31. 31. www.sagecomputing.com.auwww.sagecomputing.com.au Page 0Page 0 –– NavigationNavigation MechanismsMechanisms
  32. 32. www.sagecomputing.com.auwww.sagecomputing.com.au Development Techniques
  33. 33. www.sagecomputing.com.auwww.sagecomputing.com.au Query ScreensQuery Screens Update/insert screens can be used for query only Create a database function to return user role or application context Set an application item based on the function Set item read only display dependent on item
  34. 34. www.sagecomputing.com.auwww.sagecomputing.com.au Query ScreensQuery Screens -- StepsSteps Create database function to determine privilege
  35. 35. www.sagecomputing.com.auwww.sagecomputing.com.au Query ScreensQuery Screens -- StepsSteps Populate item using function from an Application Level Process Create Application level item
  36. 36. www.sagecomputing.com.auwww.sagecomputing.com.au Query ScreensQuery Screens -- StepsSteps Set item properties
  37. 37. www.sagecomputing.com.auwww.sagecomputing.com.au Query ScreensQuery Screens -- StepsSteps Make buttons conditional
  38. 38. www.sagecomputing.com.auwww.sagecomputing.com.au UsingUsing JavascriptJavascript Client side manipulation Setting field values Hiding/displaying fields Disabling fields Standard routines in: /i/javascript/core.js, /i/javascript/functions.js, /i/javascript/htmldb_data.js, /i/javascript/htmldb_html_elements.js, /i/javascript/htmldb_objectlist.js, /i/javascript/htmldb_validate.js, /i/javascript/htmldb_xml.js Can upload / include custom files If you are over 30 get a graduate to write it – too many curly brackets Always steal someone else’s code if possible
  39. 39. www.sagecomputing.com.auwww.sagecomputing.com.au CustomCustom JavascriptJavascript FileFile Core.js is in application server directory Not accessible to most developers Use for corporate level Javascript only Create custom Javascript file for each workspace Load into the Apex repository Reference in the templates <script src="#WORKSPACE_IMAGES#custom.js" type="text/javascript">
  40. 40. www.sagecomputing.com.auwww.sagecomputing.com.au Set an Item from a CheckboxSet an Item from a Checkbox Function in custom Javascript file function setRequestDate(flag,request) { if(document.getElementById(flag).checked == true) { document.getElementById(request).value = getCurDate(); } else { document.getElementById(request).value = ""; } }
  41. 41. www.sagecomputing.com.auwww.sagecomputing.com.au Set an Item from a CheckboxSet an Item from a Checkbox Call the function in the Query’s Select list
  42. 42. www.sagecomputing.com.auwww.sagecomputing.com.au JavascriptJavascript -- ExampleExample Convert field values to upper case HTML Form Element Attributes onKeyUp="javascript:this.value = this.value.toUpperCase( );"
  43. 43. www.sagecomputing.com.auwww.sagecomputing.com.au Disable items dependent onDisable items dependent on another itemanother item Common routines in custom.js file Disable or enable items function disableFormItems(item1,item2,item3,item4,item5,item6,item7,item8,item9,item10) { for(var i=1;i<10;i++){ if (arguments[i]){ disItem = document.getElementById(arguments[i]); disItem.style.background = '#cccccc'; disItem.disabled = true; }}} function enableFormItems(item1,item2,item3,item4,item5,item6,item7,item8,item9,item10) { for(var i=1;i<10;i++){ if (arguments[i]){ disItem = document.getElementById(arguments[i]); disItem.style.background = '#ffffff'; disItem.disabled = false; }}}
  44. 44. www.sagecomputing.com.auwww.sagecomputing.com.au Disable items dependent onDisable items dependent on another itemanother item Page specific routine in page header Call the enable or disable routine
  45. 45. www.sagecomputing.com.auwww.sagecomputing.com.au Disable items dependent onDisable items dependent on another item typeanother item type Call routine from the item on which the others are dependent
  46. 46. www.sagecomputing.com.auwww.sagecomputing.com.au Disable items dependent onDisable items dependent on another itemanother item Call from item onChange="javascript:setIndividualOrganisation (document.getElementById('P3_PAR_TYPE').value);" Call from Region Footer to initialise display of items
  47. 47. www.sagecomputing.com.auwww.sagecomputing.com.au Custom LOVCustom LOV <script language="JavaScript"> function passBack(passVal1) { var returnTo = document.getElementById('P58_RETURN_ITEM').value ; opener.document.getElementById(returnTo).value = passVal1; opener.document.getElementById(returnTo).focus(); close(); } </script> <script language="JavaScript" type="text/javascript"> function callpartylov (returnTo,partyId) { var partyVal = document.getElementById(partyId).value; var url; url = 'f?p=&APP_ID.:58:&SESSION_ID.:::58:P58_RETURN_ITEM,P58_NO_CHANGE,P58_PAR_ID:‘ +returnTo+',Y,'+partyVal; w = open(url,"winLov","Scrollbars=1,resizable=1,width=850,height=600,top=40, left=40"); if (w.opener == null) w.opener = self; w.focus(); } </script> <a href="javascript:callpartylov('P34_VEQ_RESPONSIBLE_PAR_ID','P34_VEQ_RESPONSIBLE_PAR_ID');"> <IMG SRC="/i/list_gray.gif" width="13" height="13" alt="Popup Lov" alt="List" border="0" align="bottom"></a> Display LOV icon Call LOV popup Return selected value
  48. 48. www.sagecomputing.com.auwww.sagecomputing.com.au
  49. 49. www.sagecomputing.com.auwww.sagecomputing.com.au
  50. 50. www.sagecomputing.com.auwww.sagecomputing.com.au Using Ajax for Forms LikeUsing Ajax for Forms Like BehaviourBehaviour Populate on change
  51. 51. www.sagecomputing.com.auwww.sagecomputing.com.au Using Ajax for Forms LikeUsing Ajax for Forms Like BehaviourBehaviour
  52. 52. www.sagecomputing.com.auwww.sagecomputing.com.au Using Ajax for Forms LikeUsing Ajax for Forms Like BehaviourBehaviour
  53. 53. www.sagecomputing.com.auwww.sagecomputing.com.au Using Ajax for Forms LikeUsing Ajax for Forms Like BehaviourBehaviour
  54. 54. www.sagecomputing.com.auwww.sagecomputing.com.au Dependent LOVDependent LOV Four approaches Javascript Select list with Submit Popup LOV Ajax
  55. 55. www.sagecomputing.com.auwww.sagecomputing.com.au Mobile Apex
  56. 56. www.sagecomputing.com.auwww.sagecomputing.com.au Project Progress ApplicationProject Progress Application Run on PDA Wireless or dial in connection Strip out template contents Minimise typing
  57. 57. www.sagecomputing.com.auwww.sagecomputing.com.au Increment a DateIncrement a Date Click here to increment the Actual Start Date by 1 day
  58. 58. www.sagecomputing.com.auwww.sagecomputing.com.au Increment a DateIncrement a Date Function in custom Javascript file function incRequestDate(request) { var dateStr = document.getElementById(request).value; if (dateStr != "") { var dayStr = dateStr.substr(0,2); var monthStr = dateStr.substr(3,3); var yearStr = dateStr.substr(7,4); if (yearStr.substr(0,2) != "20" ) {yearStr2 = "20" + yearStr;} else {yearStr2 = yearStr;} var incDateStr = monthStr + " " + dayStr + "," + yearStr2; var d = new Date(incDateStr); var n = d.getTime()+86400000; var d1 = new Date(n); var monthname=new Array ("JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"); var newDateStr = d1.getDate()+"-"+monthname[d1.getMonth()]+"-"+d1.getYear(); document.getElementById(request).value = newDateStr;} }
  59. 59. www.sagecomputing.com.auwww.sagecomputing.com.au Increment a DateIncrement a Date Call the function in the Query’s Select list
  60. 60. www.sagecomputing.com.auwww.sagecomputing.com.au What’s new in version 3.0
  61. 61. www.sagecomputing.com.auwww.sagecomputing.com.au Repository level Workspace level Expiry time Format Change on first use Lock account Password ControlsPassword Controls
  62. 62. www.sagecomputing.com.auwww.sagecomputing.com.au Define workspace size Email your workspace names View login attempts Task list on App Builder home page Workspace ManagementWorkspace Management
  63. 63. www.sagecomputing.com.auwww.sagecomputing.com.au AgendaAgenda Application Definition is under Shared Components Supporting Objects enhanced
  64. 64. www.sagecomputing.com.auwww.sagecomputing.com.au AgendaAgenda
  65. 65. www.sagecomputing.com.auwww.sagecomputing.com.au AgendaAgenda
  66. 66. www.sagecomputing.com.auwww.sagecomputing.com.au AgendaAgenda
  67. 67. www.sagecomputing.com.auwww.sagecomputing.com.au AgendaAgenda
  68. 68. www.sagecomputing.com.auwww.sagecomputing.com.au AgendaAgenda
  69. 69. www.sagecomputing.com.auwww.sagecomputing.com.au AgendaAgenda
  70. 70. www.sagecomputing.com.auwww.sagecomputing.com.au AgendaAgenda
  71. 71. www.sagecomputing.com.auwww.sagecomputing.com.au AgendaAgenda
  72. 72. www.sagecomputing.com.auwww.sagecomputing.com.au AgendaAgenda
  73. 73. www.sagecomputing.com.auwww.sagecomputing.com.au AgendaAgenda
  74. 74. www.sagecomputing.com.auwww.sagecomputing.com.au Zero as session id on public pages
  75. 75. www.sagecomputing.com.auwww.sagecomputing.com.au
  76. 76. www.sagecomputing.com.auwww.sagecomputing.com.au Shared Component link on each page
  77. 77. www.sagecomputing.com.auwww.sagecomputing.com.au
  78. 78. www.sagecomputing.com.auwww.sagecomputing.com.au Date picker using default format mask Improved Web services Page Type displayed in Application page Additions to item finder (css, images) Developer toolbar has Home and Workspace Activity links Pre element item attribute DML locking with WAIT/NOWAIT Other New FeaturesOther New Features
  79. 79. www.sagecomputing.com.auwww.sagecomputing.com.au Thank You For Your Attention Enquiries@sagecomputing.com.au SAGE Computing ServicesSAGE Computing Services Customised Oracle Training WorkshopsCustomised Oracle Training Workshops and Consultingand Consulting www.sagecomputing.com.auwww.sagecomputing.com.au

×