Advertisement

APEX Bad Practices

Director & Senior APEX Developer at APEX Consulting
Apr. 3, 2020
Advertisement

More Related Content

Advertisement

APEX Bad Practices

  1. Copyright © 2019 APEX Consulting APEX Bad Practices
  2. <bragging>
  3. </bragging>
  4. 3 Membership Tiers • Oracle ACE Director • Oracle ACE • Oracle ACE Associate bit.ly/OracleACEProgram 500+ Technical Experts Helping Peers Globally Connect: Nominate yourself or someone you know: acenomination.oracle.com @oracleace Facebook.com/oracleaces oracle-ace_ww@oracle.com
  5. Get organised Dude, where’s my code? And what about JavaScript … Miscellaneous
  6. Get organised
  7. Naming stuff
  8. Need a Page Item Value on other pages? Use an Application Item Use P0_EMPNO Use P1_EMPNO
  9. $(“#P1_EMPNO”)apex.item(“P1_EMPNO”)
  10. Divide and conquer
  11. A few Applications with a lot of Pages
  12. A lot of Applications with a few Pages
  13. MASTER SEED subscription APP 1 APP 2 APP 3 copy subscription subscription subscription
  14. ✅ ❌ ❔ ❌ ❌ ❌ ❌ ✅ ✅ ✅ ❌ ❌ ❌ ✅ ✅ ✅ ❌ ❌ ❌ ❌ ❌ ❌ ❌ ✅ ❌ ✅ ❌ ✅ ✅ ❌ ❌ ❌ ❌ ❌ ❌
  15. Page 0
  16. Unsubscribe
  17. NEVER Unsubscribe
  18. Don’t put your files in the APEX directories
  19. /usr/local/tomcat/webapps/i
  20. /usr/local/tomcat/webapps/ mycode /mycode/js/myJsFile.js
  21. Get organised Dude, where’s my code? And what about JavaScript … Miscellaneous
  22. Get organised Dude, where’s my code? And what about JavaScript … Miscellaneous
  23. Dude, where’s my code?
  24. Process Region / Item Source Condition Read Only Condition Item Default Dynamic Action Validation Where CAN you put your PL/SQL?
  25. Where SHOULD you put your PL/SQL? Reusable Testable Compiled Dependencies
  26. Some more remarks regarding PL/SQL
  27. select * from my_big_table where field = v('P2_EMPNO')
  28. select * from my_big_table where field = ( select v('P2_EMPNO') from dual )
  29. with param as ( select v('P2_EMPNO') empno from dual ) select * from my_big_table , param where field = param.empno
  30. with param as ( select /*+ MATERIALIZE */ v('P2_EMPNO') empno from dual ) select * from my_big_table , param where field = param.empno
  31. FORMAT MASK
  32. render / submit / ajax
  33. Beware of undocumented features
  34. APEX 5 APEX 18 :APXWS_SEARCH_STRING_1 :APXWS_EXPR_1 :apex$f1 https://roelhartman.blogspot.com/2016/07/prevent-general-row-based-search-in.html
  35. Get organised Dude, where’s my code? And what about JavaScript … Miscellaneous
  36. Get organised Dude, where’s my code? And what about JavaScript … Miscellaneous
  37. And what about JavaScript
  38. Page “JavaScript section” Page header / footer Region header / footer Item Pre / Post Text URL target Dynamic Action When / Condition DA Action : Execute JavaScript Code Where CAN you put your JavaScript?
  39. Where SHOULD you put your JavaScript? In a file (on your network / static app file) (reference in the User Interface Details) In a Plugin (JavaScript file) Roels Rule : No JavaScript anywhere else
  40. The code is more what you'd call "guidelines" than actual rules
  41. How should you code your JavaScript? $(“#P1_EMPNO”) or apex.item(“P1_EMPNO”)
  42. How should you code your JavaScript? $v(“#P1_EMPNO”) or apex.item(“P1_EMPNO”).getValue()
  43. How should you code your JavaScript? $v(“P1_EMPNO”) or apex.item(“P1_EMPNO”).getValue()
  44. Know your APEX JavaScript API’s https://docs.oracle.com/en/database/oracle/application-express/19.1/aexjs/index.html
  45. Beware of undocumented features
  46. gReport
  47. htmldb_Get
  48. A lot of stuff in the Interactive Grid
  49. Watch your plugins
  50. Beware of undocumented features
  51. Beware of DOCUMENTED features
  52. function render ( p_dynamic_action in apex_plugin.t_dynamic_action , p_plugin in apex_plugin.t_plugin ) return apex_plugin.t_dynamic_action_render_result is l_result apex_plugin.t_dynamic_action_render_result; begin l_result.javascript_function := 'function(){ openModal( this.affectedElements[0].id ); }'; return l_result; end;
  53. function render ( p_dynamic_action in apex_plugin.t_dynamic_action , p_plugin in apex_plugin.t_plugin ) return apex_plugin.t_dynamic_action_render_result is l_result apex_plugin.t_dynamic_action_render_result; begin l_result.javascript_function := 'function(){ openModal( this.affectedElements[0].id ); }'; return l_result; end;
  54. function render ( p_dynamic_action in apex_plugin.t_dynamic_action , p_plugin in apex_plugin.t_plugin ) return apex_plugin.t_dynamic_action_render_result is l_result apex_plugin.t_dynamic_action_render_result; begin l_result.javascript_function := 'function({ apex.theme.openRegion( this.affectedElements[0].id ); }'; return l_result; end;
  55. Get organised Dude, where’s my code? And what about JavaScript … Miscellaneous
  56. Get organised Dude, where’s my code? And what about JavaScript … Miscellaneous
  57. Miscellaneous
  58. Dynamic Actions are cool
  59. Page Process / Computation
  60. Region refresh Page refresh Row refresh
  61. function render ( p_dynamic_action in apex_plugin.t_dynamic_action , p_plugin in apex_plugin.t_plugin ) return apex_plugin.t_dynamic_action_render_result is l_result apex_plugin.t_dynamic_action_render_result; begin l_result.javascript_function := 'function(){ var myGrid = apex.region( this.affectedElements[0].id ) .widget().interactiveGrid("getViews").grid; myGrid.model.fetchRecords( myGrid.getSelectedRecords() ); }'; return l_result; end;
  62. Get organised Dude, where’s my code? And what about JavaScript … Miscellaneous
  63. Copyright © 2019 APEX Consulting Q& A@roelh roel@apexconsulting.nl http://www.apexconsulting.nl
  64. @roelh roel@apexconsulting.nl http://www.apexconsulting.nl Copyright © 2019 APEX Consulting
Advertisement