Repor&ng Solu&ons for Oracle APEX - Choose Your - - PowerPoint PPT Presentation

repor ng solu ons for oracle apex choose your weapons
SMART_READER_LITE
LIVE PREVIEW

Repor&ng Solu&ons for Oracle APEX - Choose Your - - PowerPoint PPT Presentation

Repor&ng Solu&ons for Oracle APEX - Choose Your Weapons Dietmar Aust Opal-Consul&ng, Kln www.opal-consul&ng.de Vorstellung Opal Consul&ng


slide-1
SLIDE 1

Repor&ng ¡Solu&ons ¡for ¡Oracle ¡APEX ¡-­‑ ¡ Choose ¡Your ¡Weapons ¡

Dietmar ¡Aust ¡ Opal-­‑Consul&ng, ¡Köln ¡ www.opal-­‑consul&ng.de ¡

slide-2
SLIDE 2

► Building ¡Oracle ¡based ¡Web ¡Applica&ons ¡since ¡1997 ¡

▪ Portal, ¡Forms, ¡Reports, ¡OWA ¡Toolkit, ¡now ¡APEX! ¡

► Dipl.-­‑Inform. ¡Dietmar ¡Aust, ¡Freelance ¡Consultant ¡

▪ Master's ¡Degree ¡in ¡Computer ¡Science ¡(MSCS) ¡

► 1997-­‑2000: ¡Consultant ¡at ¡Oracle ¡Germany ¡ ► Since ¡09/2000: ¡Freelance ¡Consultant, ¡Since ¡2006 ¡– ¡APEX ¡

  • nly! ¡

► Blog: ¡h[p://daust.blogspot.com/ ¡ ► Regular ¡presenter ¡at ¡Oracle ¡conferences ¡(ODTUG, ¡DOAG, ¡ OOW) ¡ ► Author ¡of ¡the ¡JasperReportsIntegra&on ¡toolkit ¡

▪ h[p://www.opal-­‑consul&ng.de/tools ¡

¡

Vorstellung ¡Opal ¡Consul&ng ¡ ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 2

slide-3
SLIDE 3

Major ¡Use ¡Cases ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 3

slide-4
SLIDE 4

Major ¡Use ¡Cases ¡

  • 1. ¡Standard ¡Repor&ng ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 4

slide-5
SLIDE 5

► What ¡is ¡it ¡/ ¡Examples? ¡

▪ Crea&ng ¡Invoices, ¡Order ¡Confirma&ons, ¡Contracts ¡ ▪ Management ¡reports ¡/ ¡dashboards ¡/ ¡charts ¡

► Characteris&cs ¡

▪ Client-­‑independence, ¡can ¡possibly ¡be ¡downloaded ¡from ¡your ¡website ¡ ▪ Not ¡easily ¡modifyable ¡ ▪ Need ¡pixel ¡perfect ¡layout ¡/ ¡corporate ¡design ¡ ▪ Fixed ¡layout, ¡infrequent ¡changes ¡ ▪ Generate ¡as ¡BLOB, ¡can ¡be ¡stored ¡in ¡the ¡database ¡together ¡with ¡the ¡ client ¡/ ¡order ¡entry, ¡etc. ¡

Major ¡Use ¡Cases ¡

  • 1. ¡Standard ¡Repor&ng ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 5

slide-6
SLIDE 6

► What ¡is ¡it ¡/ ¡Examples ¡ ¡-­‑ ¡two ¡situa&ons: ¡

  • 1. Genera&ng ¡a ¡MS ¡Word ¡document ¡for ¡further ¡modifica&on ¡(e.g. ¡flexible ¡

customer ¡communica&on), ¡E.g. ¡flexible ¡offer ¡crea&on ¡where ¡you ¡need ¡to ¡ add ¡calcula&ons ¡from ¡MS ¡Excel ¡or ¡add ¡images, ¡etc. ¡

  • 2. The ¡template ¡does ¡already ¡exist ¡as ¡a ¡MS ¡Word ¡document ¡

► Characteris&cs ¡

▪ Needs ¡to ¡be ¡modifyable ¡aier ¡the ¡genera&on ¡ ▪ Corporate ¡design ¡s&ll ¡important ¡ ▪ Possibly ¡frequent ¡changes ¡in ¡the ¡template ¡

Major ¡Use ¡Cases ¡

  • 2. ¡Flexible ¡Repor&ng ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 6

slide-7
SLIDE 7

► What ¡is ¡it ¡/ ¡Examples? ¡

▪ The ¡users ¡want ¡to ¡export ¡the ¡data ¡to ¡further ¡process ¡it ¡

► Characteris&cs ¡

▪ Proper ¡data ¡types ¡– ¡CSV ¡format ¡problema&c ¡ ▪ Perhaps ¡formajng ¡ ▪ Export ¡mul&ple ¡worksheets ¡at ¡the ¡same ¡&me ¡ ▪ Using ¡na&ve ¡features ¡like ¡autofilter, ¡macros, ¡condi&onal ¡formajng ¡ ▪ Show ¡/ ¡hide ¡columns ¡ ▪ Charts, ¡Pivot-­‑tables, ¡password ¡protec&on ¡for ¡files ¡and ¡worksheets ¡

Major ¡Use ¡Cases ¡

  • 3. ¡Data ¡Export ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 7

slide-8
SLIDE 8

Major ¡Use ¡Cases ¡

  • 3. ¡Data ¡Export ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 8

slide-9
SLIDE 9

Integra&on ¡Strategies ¡for ¡ APEX ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 9

slide-10
SLIDE 10

► APEX ¡out-­‑of-­‑the-­‑box ¡support ¡: ¡ ¡ ► Interac&ve ¡Reports: ¡ ► Classic ¡Reports: ¡ ¡

▪ CSV ¡ ▪ XML ¡

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 1. ¡Out ¡of ¡the ¡Box ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 10

slide-11
SLIDE 11

► XSL ¡-­‑ ¡Formajng ¡Objects ¡

▪ Markup ¡Language ¡for ¡XML ¡documents ¡ ▪ Requires ¡an ¡XSL-­‑FO ¡Processor ¡to ¡generate ¡the ¡final ¡doc ¡

► Oracle ¡APEX ¡uses ¡Apache ¡FOP ¡(1.0), ¡ships ¡the ¡file ¡fop.war ¡to ¡be ¡deployed ¡in ¡ an ¡OC4J ¡J2EE ¡server. ¡ ► ¡Basically ¡what ¡we ¡need ¡at ¡run&me ¡are ¡two ¡xml ¡files: ¡ ¡

▪ The ¡data ¡ ¡ ▪ The ¡layout ¡

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 2. ¡APEX ¡Print ¡Engine ¡FOP ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 11

slide-12
SLIDE 12

► The ¡Architecture ¡

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 2. ¡APEX ¡Print ¡Engine ¡FOP ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 12

slide-13
SLIDE 13

► Setup ¡in ¡the ¡Internal ¡Administra&on: ¡ ¡

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 2. ¡APEX ¡Print ¡Engine ¡FOP ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 13

slide-14
SLIDE 14

► Interac&ve ¡Reports: ¡

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 2. ¡APEX ¡Print ¡Engine ¡FOP ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 14

slide-15
SLIDE 15

► The ¡basic ¡integra&on ¡uses ¡ Generic ¡Columns ¡ ► Each ¡column ¡is ¡forma[ed ¡in ¡the ¡ same ¡way ¡ ► Basic ¡formajng ¡in ¡the ¡print ¡ sec&on ¡for ¡classic ¡reports: ¡ ¡

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 2. ¡APEX ¡Print ¡Engine ¡FOP ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 15

slide-16
SLIDE 16

► You ¡can ¡also ¡use ¡Named ¡Columns ¡Templates ¡ ► Step ¡1: ¡get ¡the ¡XML ¡either ¡from ¡an ¡exis&ng ¡report ¡or ¡from ¡a ¡defined ¡report ¡ query ¡ ► Step ¡2: ¡Design ¡the ¡layout ¡based ¡on ¡the ¡sample ¡XML ¡file ¡ ► Step ¡3: ¡Upload ¡the ¡XSL-­‑FO ¡file ¡to ¡Shared ¡Components ¡> ¡Reports ¡> ¡Report ¡ Layouts ¡

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 2. ¡APEX ¡Print ¡Engine ¡FOP ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 16

slide-17
SLIDE 17

► Demo: ¡Classic ¡report ¡with ¡named ¡columns ¡layout ¡

  • 1. Get ¡XML ¡data ¡from ¡classic ¡report ¡
  • 2. Upload ¡named ¡columns ¡layout ¡
  • 3. Use ¡classic ¡report ¡with ¡named ¡columns ¡layout ¡

► Demo: ¡Using ¡report ¡query ¡and ¡layout ¡together ¡

  • 1. Get ¡XML ¡data ¡from ¡report ¡query ¡
  • 2. Upload ¡named ¡columns ¡layout ¡
  • 3. Assign ¡layout ¡to ¡query ¡
  • 4. Create ¡bu[on ¡for ¡calling ¡the ¡report ¡

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 2. ¡APEX ¡Print ¡Engine ¡FOP ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 17

slide-18
SLIDE 18

► Using ¡the ¡API ¡APEX_UTIL.GET_PRINT_DOCUMENT ¡

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 2. ¡APEX ¡Print ¡Engine ¡FOP ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 18

► 4 ¡different ¡func&on ¡ signatures ¡available ¡ ► Generates ¡BLOB ¡ ► Need ¡to ¡generate ¡the ¡ report ¡data ¡yourself ¡for ¡ use ¡with ¡dbms_scheduler, ¡ no ¡APEX ¡context ¡here ¡

slide-19
SLIDE 19

► Complete ¡step-­‑by-­‑step ¡example ¡from ¡Marc ¡Sewtz: ¡ h[p://marcsewtz.blogspot.de/2013/04/pdf-­‑prin&ng-­‑with-­‑oracle-­‑ applica&on.html ¡ ► XSL-­‑FO ¡WYSIWYG ¡Design ¡Tools ¡ ► ALTOVA ¡StyleVision ¡Enterprise ¡($629) ¡ ¡

▪ MS-­‑Windows ¡Only ¡

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 2. ¡APEX ¡Print ¡Engine ¡FOP ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 19

slide-20
SLIDE 20

► ALTOVA ¡StyleVision ¡Enterprise ¡($629) ¡ ¡

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 2. ¡APEX ¡Print ¡Engine ¡FOP ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 20

slide-21
SLIDE 21

► ALTOVA ¡StyleVision ¡Enterprise ¡($629) ¡ ¡

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 2. ¡APEX ¡Print ¡Engine ¡FOP ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 21

slide-22
SLIDE 22

► StylusStudio ¡($695) ¡

▪ MS-­‑Windows ¡Only ¡

► Java4Less ¡FO-­‑Designer ¡($124.60) ¡ ¡

▪ h[p://www.java4less.com/fopdesigner/fodesigner.php ¡ ▪ Cross ¡Plarorm ¡(MAC, ¡Linux, ¡Windows, ¡...) ¡ ▪ Special ¡focus ¡on ¡Oracle ¡APEX, ¡step ¡by ¡step ¡instruc&ons ¡ ▪ Gets ¡you ¡up ¡and ¡running ¡quickly ¡ ▪ Windows ¡installer ¡for ¡their ¡own ¡J4L ¡FOP ¡print ¡server ¡(op&onal) ¡, ¡uses ¡Je[y ¡J2EE ¡ Server ¡and ¡works ¡immediately ¡ ▪ Cheap ¡in ¡comparison ¡ ▪ Designer ¡somewhat ¡limited ¡but ¡works ¡in ¡real ¡world ¡projects ¡

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 2. ¡APEX ¡Print ¡Engine ¡FOP ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 22

slide-23
SLIDE 23

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 2. ¡APEX ¡Print ¡Engine ¡FOP ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 23

slide-24
SLIDE 24

► APEX ¡LISTENER ¡2.0+ ¡& ¡APEX ¡4.2.2+ ¡

▪ Includes ¡FOP ¡support ¡ ▪ No ¡extra ¡J2EE ¡container ¡necessary ¡

► Needs ¡to ¡be ¡configured ¡in ¡internal ¡administra&on ¡ ► Does ¡not ¡work ¡with ¡APEX_UTIL.GET_PRINT_DOCUMENT ¡API ¡

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 2a. ¡APEX ¡Print ¡Engine ¡FOP ¡(internal ¡with ¡APEX ¡Listener) ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 24

slide-25
SLIDE 25

► Architecture ¡

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 2a. ¡APEX ¡Print ¡Engine ¡FOP ¡(internal ¡with ¡APEX ¡Listener) ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 25

slide-26
SLIDE 26

► Oracle ¡BI ¡Publisher ¡ ► Powerful, ¡complete ¡repor&ng ¡solu&on ¡ ► Step ¡1: ¡get ¡the ¡XML ¡either ¡from ¡an ¡exis&ng ¡report ¡or ¡from ¡a ¡defined ¡report ¡ query ¡ ► Step ¡2: ¡Design ¡the ¡layout ¡based ¡on ¡the ¡sample ¡XML ¡file ¡using ¡MS ¡Word ¡and ¡ the ¡BI ¡Publisher ¡Plugin ¡ ► Step ¡3: ¡Upload ¡the ¡RTF ¡template ¡to ¡Shared ¡Components ¡> ¡Reports ¡

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 3. ¡APEX ¡Print ¡Engine ¡BI ¡Publisher ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 26

slide-27
SLIDE 27

► Addi&onal ¡formats: ¡MS ¡Word, ¡MS ¡Excel ¡ ► Handles ¡all ¡the ¡use ¡cases ¡pre[y ¡well ¡ ► You ¡can ¡leverage ¡exis&ng ¡templates ¡in ¡MS ¡Word ¡but ¡also ¡easily ¡produce ¡other ¡

  • utput ¡formats ¡like ¡PDF ¡or ¡MS ¡Excel ¡

► Too ¡expensive ¡for ¡most ¡projects ¡

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 3. ¡APEX ¡Print ¡Engine ¡BI ¡Publisher ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 27

slide-28
SLIDE 28

► PL/PDF ¡(h[p://www.plpdf.com/) ¡ ► Provides ¡a ¡set ¡of ¡PL/SQL ¡based ¡APIs ¡to ¡generate ¡PDF ¡files ¡from ¡the ¡Oracle ¡ database ¡ ► License ¡cost: ¡600$ ¡per ¡Oracle ¡instance ¡ ► A ¡simple ¡example: ¡

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 4. ¡PL/SQL ¡based ¡genera&on ¡– ¡PL/PDF ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 28

slide-29
SLIDE 29

► No ¡GUI ¡for ¡designing ¡the ¡report, ¡everything ¡needs ¡to ¡be ¡coded ¡ ► Interes&ng ¡features ¡for ¡manipula&ng ¡PDFs ¡

▪ PDF ¡Encrpy4on/Decryp4on ¡(40/128 ¡bit ¡RC4, ¡AES ¡and ¡Public ¡Key) ¡ ▪ PDF ¡Metadata ¡manipula&on ¡ ▪ Extrac&on ¡of ¡text ¡from ¡PDF ¡ ▪ Merging ¡PDF ¡documents ¡(2, ¡10 ¡or ¡unlimited) ¡ ▪ Replacement ¡of ¡URLs ¡in ¡a ¡PDF ¡document ¡ ▪ Stamp ¡content ¡or ¡watermark ¡into ¡a ¡PDF ¡document ¡(JPG/Text) ¡ ▪ Export ¡and ¡Import ¡PDF ¡form ¡data ¡(FDF ¡and ¡XFDF) ¡ ▪ Extract ¡pages ¡to ¡a ¡new ¡PDF ¡ ▪ Get ¡number ¡of ¡pages ¡ ▪ Compress ¡JPG ¡images ¡in ¡PDF ¡ ▪ add ¡Digital ¡Signature ¡to ¡PDF ¡

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 4. ¡PL/SQL ¡based ¡genera&on ¡– ¡PL/PDF ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 29

slide-30
SLIDE 30

► JasperReports ¡h[p://sourceforge.net/projects/jasperreports/ ¡ ¡ ► What ¡is ¡it? ¡

▪ Java ¡library ¡(jar ¡file), ¡can ¡be ¡be ¡embedded ¡into ¡any ¡java ¡applica&on ¡(e.g. ¡SWING, ¡ RCP, ¡J2EE, ¡on ¡the ¡command ¡line ¡using ¡ANT ¡or ¡just ¡a ¡plain ¡Java ¡Run&me) ¡ ▪ It ¡ships ¡with ¡other ¡Open ¡Source ¡libraries ¡like ¡iText, ¡Groovy, ¡Hibernate, ¡ JFreeChart, ¡Log4J, ¡POI, ¡etc. ¡ ▪ Community ¡and ¡professional ¡edi&ons ¡

► License: ¡GNU ¡Lesser ¡General ¡Public ¡License ¡version ¡3 ¡(LGPLv3) ¡

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 4. ¡External ¡Repor&ng ¡Engine: ¡JasperReports ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 30

slide-31
SLIDE 31

► Features: ¡ ¡

▪ JasperReports ¡provides ¡a ¡comprehensive ¡feature ¡set ¡ ▪ Data ¡sources: ¡JDBC, ¡XML, ¡OLAP, ¡TEXT, ¡Hadoop ¡…, ¡and ¡extensibility ¡through ¡ ¡ custom ¡data ¡sources, ¡mul&ple ¡data ¡sources ¡per ¡report ¡ ▪ Output ¡formats: ¡pdf, ¡xls, ¡xlsx, ¡html, ¡xhmtl, ¡csv, ¡text, ¡rr, ¡odf, ¡docx, ¡pptx, ¡.. ¡ ▪ Matrix ¡reports ¡ ▪ Charts ¡(Jfreechart) ¡ ▪ Report ¡trigger ¡ ▪ Subreports ¡/ ¡modulariza&on ¡/ ¡reusuability ¡ ▪ Condi&onal ¡formajng ¡(styles) ¡ ▪ Condi&onal ¡rendering ¡of ¡elements ¡ ¡ ▪ Scrip&ng ¡languages, ¡especially ¡for ¡condi&ons ¡and ¡calcula&ons: ¡Java, ¡Groovy, ¡ Javascript ¡ ▪ Fonts, ¡Unicode, ¡NLS ¡ ▪ ... ¡

► Visual ¡report ¡layout ¡with ¡the ¡iReport ¡designer ¡

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 4. ¡External ¡Repor&ng ¡Engine: ¡JasperReports ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 31

slide-32
SLIDE 32

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 4. ¡External ¡Repor&ng ¡Engine: ¡JasperReports ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 32

slide-33
SLIDE 33

► Integra&on ¡with ¡APEX ¡ ► 1: ¡Client ¡clicks ¡on ¡a ¡link ¡ ¡ ¡ ► 2: ¡APEX ¡calls ¡the ¡JasperIntegra&on ¡in ¡ ¡ ¡ ¡ ¡ ¡the ¡J2EE ¡Server ¡(Tomcat) ¡and ¡passes ¡ ¡ ¡ ¡ ¡just ¡the ¡parameters ¡(report_name, ¡ ¡ ¡ ¡ ¡ ¡connect ¡informa&on, ¡report ¡parameters) ¡ ► 3: ¡JasperReports ¡starts ¡a ¡database ¡connec&on ¡ ¡ ¡ ¡ ¡and ¡generates ¡the ¡report ¡

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 4. ¡External ¡Repor&ng ¡Engine: ¡JasperReports ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 33

slide-34
SLIDE 34

► Integra&on ¡Kit ¡available: ¡ h[p://www.opal-­‑consul&ng.de/tools ¡ ► License: ¡BSD ¡– ¡do ¡whatever ¡you ¡like ¡but ¡ don‘t ¡sue ¡me ¡ ► Indepth ¡analysis ¡of ¡use ¡cases ¡for ¡moving ¡ from ¡Oracle ¡Reports ¡to ¡JasperReports ¡at ¡ KScope ¡2012 ¡ ► Step ¡by ¡step ¡integra&on ¡into ¡the ¡sample ¡ applica&on: ¡

h[p://www.opal-­‑consul&ng.de/downloads/ free_tools/JasperReportsIntegra&on/Opal-­‑ Consul&ng-­‑JasperReportsIntegra&on.pdf ¡

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 4. ¡External ¡Repor&ng ¡Engine: ¡JasperReports ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 34

slide-35
SLIDE 35

► Concep&onally ¡expose ¡repor&ng ¡func&onality ¡using ¡an ¡URL ¡based ¡interface ¡ which ¡passes ¡parameters ¡and ¡just ¡triggers ¡the ¡execu&on ¡of ¡a ¡report ¡ somewhere ¡else, ¡then ¡returns ¡the ¡generated ¡document. ¡ ► Integra&on ¡typically ¡uses ¡UTL_HTTP ¡or ¡APEX_WEB_SERVICE ¡ ► Thus, ¡all ¡kinds ¡of ¡engines ¡can ¡be ¡used: ¡ ¡

▪ Oracle ¡Reports, ¡Chrystal ¡Reports, ¡Eclipse ¡BIRT ¡ ▪ Business ¡Objects ¡ ▪ ... ¡

► Powerful ¡engines, ¡perhaps ¡already ¡installed ¡in ¡your ¡corpora&on ¡ ¡ ► You ¡have ¡to ¡deal ¡with ¡security, ¡though. ¡SSO ¡might ¡be ¡challenging ¡but ¡there ¡ are ¡simple ¡workarounds. ¡ ¡

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 5. ¡External ¡Repor&ng ¡Engine: ¡Other ¡Engines ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 35

slide-36
SLIDE 36

► PL-­‑jrxml2pdf ¡h[p://sourceforge.net/projects/pljrxml2pdf/ ¡ ¡ ► Open ¡Source ¡project ¡developed ¡by ¡Andreas ¡Weiden ¡ ► License: ¡MIT ¡ ► The ¡concept ¡

▪ Design ¡your ¡report ¡layout ¡using ¡the ¡iReport ¡Designer ¡/ ¡Jaspersoi ¡Studio ¡ ▪ Use ¡a ¡pure ¡PL/SQL ¡based ¡run&me ¡engine ¡based ¡on ¡the ¡package ¡AS_PDF3 ¡wri[en ¡ by ¡Anton ¡Scheffer ¡to ¡process ¡the ¡.jrxml ¡defini&on ¡file ¡

► Use ¡a ¡GUI ¡tool ¡design ¡your ¡reports ¡(live ¡jdbc ¡connec&on ¡and ¡preview) ¡ ► Deploy ¡it ¡in ¡a ¡pure ¡PL/SQL ¡environment ¡ ► Does ¡not ¡support ¡all ¡of ¡the ¡JasperReports ¡features, ¡but ¡very ¡many ¡ ► Can ¡always ¡move ¡the ¡defini&ons ¡to ¡a ¡„real“ ¡, ¡java ¡based ¡run&me ¡ ¡

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 4. ¡PL/SQL ¡based ¡genera&on ¡– ¡PL-­‑jrxml2pdf ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 36

slide-37
SLIDE 37

► Features ¡

▪ Text ¡styling, ¡condi&onal ¡styling, ¡frames, ¡borders, ¡colors ¡ ▪ Condi&onal ¡rendering, ¡basic ¡Java ¡operators ¡(+,-­‑,=,>, ¡AND, ¡OR, ¡NOT, ¡IS ¡NULL, ¡...) ¡ are ¡translated ¡to ¡pl/sql ¡ ▪ Report ¡tables ¡ ▪ Crosstabs ¡ ▪ Subreports ¡ ▪ Groups ¡ ▪ Custom ¡Fonts ¡ ▪ Images ¡ ▪ NLS-­‑support, ¡also ¡transla&ons ¡using ¡Resource ¡Files ¡ ▪ Charts ¡ ▪ Genera&ng ¡a ¡single ¡PDF ¡from ¡mul&ple ¡report ¡defini&ons ¡ ▪ HTML ¡field ¡support ¡(basic) ¡ ▪ Google ¡Map ¡Images ¡ ▪ JRXML-­‑Generator ¡for ¡quickly ¡crea4ng ¡a ¡basic ¡report ¡defini4on ¡file ¡from ¡an ¡APEX ¡ page ¡

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 4. ¡PL/SQL ¡based ¡genera&on ¡– ¡PL-­‑jrxml2pdf ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 37

slide-38
SLIDE 38

► Doxxy ¡by ¡iAdvise ¡( ¡h[p://www.doxxy.eu/ ¡) ¡ ► The ¡concept ¡

▪ Take ¡an ¡exis&ng ¡MS ¡Word ¡(docx) ¡document ¡and ¡put ¡placeholders ¡in ¡it ¡ ▪ Pure ¡PL/SQL ¡based ¡solu&on ¡(the ¡PDF ¡converter ¡uses ¡an ¡a ¡Java ¡callout ¡to ¡the ¡OS ¡to ¡ call ¡Aspose.PDF ¡/ ¡embedded ¡license ¡included) ¡ ▪ At ¡run&me ¡parses ¡the ¡docx ¡xml ¡structures ¡and ¡replaces ¡the ¡variables ¡

► License: ¡1500€ ¡per ¡database ¡(docx ¡only) ¡

▪ 2000€ ¡(docx ¡+ ¡pdf), ¡uses ¡an ¡external ¡process ¡on ¡the ¡DB ¡host ¡(Aspose.PDF) ¡

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 6. ¡MS ¡Word ¡Templa&ng ¡using ¡Doxxy ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 38

slide-39
SLIDE 39

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 6. ¡MS ¡Word ¡Templa&ng ¡using ¡Doxxy ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 39

slide-40
SLIDE 40

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 6. ¡MS ¡Word ¡Templa&ng ¡using ¡Doxxy ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 40

slide-41
SLIDE 41

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 6. ¡MS ¡Word ¡Templa&ng ¡using ¡Doxxy ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 41

slide-42
SLIDE 42

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 6. ¡MS ¡Word ¡Templa&ng ¡using ¡Doxxy ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 42

slide-43
SLIDE 43

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 6. ¡MS ¡Word ¡Templa&ng ¡using ¡Doxxy ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 43

slide-44
SLIDE 44

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 6. ¡MS ¡Word ¡Templa&ng ¡using ¡Doxxy ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 44

slide-45
SLIDE 45

► Use ¡a ¡familiar ¡GUI ¡environment ¡=> ¡MS ¡Word ¡ ► Runs ¡in ¡a ¡pure ¡PL/SQL ¡environment ¡ ► Generates ¡a ¡„true“ ¡MS ¡Word ¡document ¡ ► Cannot ¡handle ¡complex ¡repor&ng ¡requirements ¡ ¡ ¡

Integra&on ¡Strategies ¡for ¡APEX ¡

  • 4. ¡PL/SQL ¡based ¡genera&on ¡– ¡PL-­‑jrxml2pdf ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 45

slide-46
SLIDE 46

Data ¡Export ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 46

slide-47
SLIDE 47

► Excel ¡interprets ¡and ¡modifies ¡the ¡data ¡automa4cally! ¡

▪ Street ¡No. ¡is ¡interpreted ¡either ¡as ¡text ¡or ¡number ¡(11, ¡11a) ¡ ▪ Zip-­‑code: ¡01067 ¡is ¡converted ¡to ¡number ¡1067 ¡leading ¡zeroes ¡are ¡lost!!! ¡ ▪ Ident-­‑Codes ¡> ¡12 ¡digits ¡ ¡=> ¡converts ¡to ¡scien&fic ¡nota&on ¡(E+18) ¡

Data ¡Export ¡ Export ¡with ¡proper ¡data ¡types ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 47

slide-48
SLIDE 48

► Regular ¡APEX ¡Export ¡to ¡CSV ¡when ¡using ¡Interac&ve ¡Reports ¡

▪ Workaround ¡to ¡properly ¡display ¡leading ¡zeroes ¡in ¡the ¡CSV ¡export ¡ ▪ => ¡Force ¡data ¡type ¡text ¡(e.g. ¡for ¡04178 ¡format ¡as ¡formula: ¡ ¡="04178" ¡) ¡

Data ¡Export ¡ Export ¡with ¡proper ¡data ¡types ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 48

select ¡ ¡ ¡country ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡, ¡ident ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡, ¡customer ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡, ¡customer_registered_on ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡, ¡customer_period ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡, ¡sum_of_purchases ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡, ¡street ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡, ¡street_no ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡, ¡city ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡, ¡decode(:request, ¡'CSV', ¡'="'||zip||'"', ¡zip) ¡zip ¡ ¡ ¡from ¡jdd_csv_demo ¡

slide-49
SLIDE 49

► Workaround ¡does ¡not ¡work ¡for ¡interac&ve ¡reports! ¡=> ¡CSV ¡is ¡empty! ¡

Data ¡Export ¡ Export ¡with ¡proper ¡data ¡types ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 49 ¡select ¡"CUSTOMER", ¡"CUSTOMER_PERIOD", ¡"CUSTOMER_REGISTERED_ON" ¡, ¡"SUM_OF_PURCHASES", ¡ "IDENT", ¡ ¡ ¡"STREET", ¡"STREET_NO" ¡, ¡"CITY", ¡"ZIP", ¡"COUNTRY”, ¡ ¡count(*) ¡over ¡() ¡as ¡apxws_row_cnt ¡ ¡ ¡ from ¡ ¡ ¡(select ¡* ¡ ¡ ¡ ¡ ¡ ¡from ¡ ¡ ¡ ¡ ¡(select ¡country ¡, ¡ident ¡, ¡customer ¡, ¡customer_registered_on ¡, ¡customer_period ¡, ¡ ¡ ¡ ¡ ¡ ¡ ¡sum_of_purchases ¡, ¡street ¡, ¡street_no ¡, ¡city ¡, ¡decode(:request, ¡'CSV', ¡'="'||zip||'"', ¡ zip) ¡zip ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡from ¡jdd_csv_demo ¡ ¡ ¡ ¡ ¡) ¡r ¡ ¡ ¡ ¡ ¡where("ZIP" ¡= ¡:APXWS_EXPR_1) ¡ ¡ ¡) ¡r ¡ ¡ ¡where ¡rownum ¡<= ¡to_number(:APXWS_MAX_ROW_CNT); ¡

04178 = =“04178“

slide-50
SLIDE 50

► Manual ¡export ¡to ¡CSV ¡with ¡stored ¡procedure ¡

▪ h[p://spendolini.blogspot.de/2006/04/custom-­‑export-­‑to-­‑csv.html ¡ ¡ ▪ h[p://www.astral-­‑consultancy.co.uk/cgi-­‑bin/hunbug/doco.cgi?11270 ¡ ¡

► Manual ¡export ¡to ¡HTML ¡with ¡stored ¡procedure, ¡set ¡Mime-­‑Type=MS ¡Excel ¡

▪ h[p://roelhartman.blogspot.de/2006/07/how-­‑to-­‑create-­‑neatly-­‑forma[ed-­‑excel.html ¡

Data ¡Export ¡ Export ¡with ¡proper ¡data ¡types ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 50

slide-51
SLIDE 51

► Plugins, ¡e.g. ¡by ¡Anton ¡Scheffer ¡

▪ h[p://apex-­‑plugin.com/oracle-­‑apex-­‑plugins/process-­‑type-­‑plugin/ir-­‑report-­‑to-­‑excel-­‑ xlsx_74.html ¡ ¡ ▪ Exports ¡with ¡correct ¡data ¡types ¡ ▪

  • Max. ¡26 ¡columns ¡can ¡be ¡exported ¡

▪ Does ¡not ¡respect: ¡ − The ¡selected ¡columns ¡(and ¡their ¡order), ¡the ¡filter ¡or ¡the ¡sort ¡order ¡ ¡ ▪ Always ¡just ¡outputs ¡the ¡base ¡sql ¡statement ¡of ¡the ¡interac&ve ¡report ¡

Data ¡Export ¡ Export ¡with ¡proper ¡data ¡types ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 51

slide-52
SLIDE 52

► The ¡new ¡APEX ¡4.2 ¡APIs ¡allow ¡us ¡to ¡retrieve ¡run&me ¡ query ¡of ¡the ¡interac&ve ¡report: ¡ ► APEX_IR.GET_REPORT ¡ ► APEX_IR.GET_LAST_VIEWED_REPORT_ID ¡ ► Created ¡a ¡plugin ¡for ¡the ¡interac&ve ¡report ¡using ¡the ¡ OPAL::XP ¡Publisher ¡by ¡OPAL-­‑Consul&ng ¡ ► Added ¡a ¡dynamic ¡ac&on ¡(plugin) ¡to ¡page ¡0, ¡is ¡ automa&cally ¡a[ached ¡to ¡all ¡interac&ve ¡reports ¡in ¡the ¡ applica&on ¡ ¡

Data ¡Export ¡ Export ¡with ¡proper ¡data ¡types ¡– ¡OPAL::XP ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 52

slide-53
SLIDE 53

¡

Data ¡Export ¡ Export ¡with ¡proper ¡data ¡types ¡– ¡OPAL::XP ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 53

slide-54
SLIDE 54

► OPAL::XP ¡(h[p://www.opal-­‑consul&ng.de/) ¡ ► Templa&ng ¡approach ¡to ¡add ¡data ¡to ¡your ¡na&ve ¡MS ¡Excel ¡Sheet ¡(.xls ¡/ ¡.xlsx) ¡on ¡the ¡fly ¡ ► The ¡Concept: ¡

  • 1. Provide ¡1...n ¡SQL ¡statements ¡which ¡can ¡be ¡referenced ¡through ¡an ¡alias ¡

− E.g: ¡alias_d ¡for ¡the ¡order ¡informa&on: ¡

  • 2. Excel ¡“Template” ¡contains ¡references ¡to ¡these ¡queries ¡and ¡columns ¡via ¡: ¡${<query ¡

alias>.<column ¡name>}: ¡

Data ¡Export ¡ Export ¡with ¡proper ¡data ¡types ¡– ¡OPAL::XP ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 54

SELECT ¡product_name, ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡quantity, ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡order_timestamp, ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡category, ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡sales ¡ ¡ ¡FROM ¡demo_orders ¡

slide-55
SLIDE 55

Data ¡Export ¡ Export ¡with ¡proper ¡data ¡types ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 55

slide-56
SLIDE 56

Major ¡Use ¡Cases ¡

  • 3. ¡Data ¡Export ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 56

slide-57
SLIDE 57

► Use ¡MS ¡Excel ¡to ¡format ¡your ¡export ¡ ► Correct ¡data ¡type ¡export ¡ ► Usage ¡of ¡na&ve ¡MS ¡Excel ¡features: ¡Export ¡mul&ple ¡worksheets ¡at ¡the ¡same ¡ &me, ¡autofilter, ¡macros, ¡condi&onal ¡formajng, ¡Show ¡/ ¡hide ¡columns, ¡Charts, ¡ Pivot-­‑tables, ¡password ¡protec&on ¡for ¡files ¡and ¡worksheets ¡ ► Includes ¡template ¡syntax ¡to ¡support ¡more ¡complex ¡template ¡structures, ¡but ¡ the ¡simple ¡approach ¡is ¡in ¡most ¡cases ¡absolutely ¡sufficient ¡ ► Architecture: ¡Uses ¡external ¡web ¡service, ¡communica&on ¡via ¡utl_h[p ¡ ► License: ¡ ¡

▪ 1500€ ¡per ¡dedicated ¡applica&on ¡(ASFU) ¡ ▪ 7500€ ¡per ¡server ¡

► Prototype ¡implementa&on ¡included ¡for ¡the ¡first ¡implementa&on! ¡

Data ¡Export ¡ Export ¡with ¡proper ¡data ¡types ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 57

slide-58
SLIDE 58

Discussion ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 58

slide-59
SLIDE 59

► At ¡the ¡clients ¡you ¡will ¡find ¡a ¡colorful ¡mix ¡of ¡all ¡the ¡solu&ons ¡

▪ PL/PDF ¡used ¡quite ¡oien ¡ ▪ People ¡shy ¡away ¡from ¡reques&ng ¡addi&onal ¡infrastructure, ¡the ¡DB ¡“people” ¡ prefer ¡solu&ons ¡with ¡less ¡moving ¡parts ¡=> ¡thus ¡prefer ¡a ¡pl/sql ¡only ¡solu&on ¡

► It ¡all ¡depends ¡on ¡your ¡use ¡case ¡and ¡context ¡

▪ Is ¡the ¡repor&ng ¡used ¡for ¡APEX ¡only? ¡ ▪ Do ¡you ¡need ¡batch ¡processing? ¡ ▪ Is ¡the ¡development ¡of ¡the ¡reports ¡independent ¡of ¡the ¡APEX ¡development? ¡Who ¡ does ¡it? ¡ ▪ Can ¡a ¡we ¡use ¡a ¡J2EE ¡server ¡for ¡the ¡addi&onal ¡func&onality? ¡

► Oracle ¡BI ¡Publisher ¡ ¡

▪ Perfect ¡fit ¡for ¡the ¡different ¡use ¡cases ¡ ▪ Just ¡very ¡expensive ¡

Discussion ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 59

slide-60
SLIDE 60

► Personally, ¡I ¡would ¡use ¡different ¡tools ¡to ¡handle ¡the ¡different ¡output ¡formats: ¡

▪ PDF, ¡MS ¡Word, ¡MS ¡Excel ¡

▪ Why? ¡ ¡

▪ Completely ¡different ¡use ¡cases ¡ ▪ The ¡generated ¡MS ¡Word ¡or ¡MS ¡Excel ¡is ¡not ¡na&ve ¡and ¡cannot ¡be ¡easily ¡changed ¡

► When ¡evalua&ng, ¡TRY ¡to ¡implement ¡YOUR ¡maximum ¡requirements ¡

▪ Which ¡formats ¡for ¡what ¡purpose? ¡PDF, ¡MS ¡Word ¡and ¡MS ¡Excel ¡required? ¡ ▪ Mul&-­‑language ¡capable? ¡NLS ¡(number, ¡dates) ¡and ¡Labels? ¡ ▪ Formajng? ¡ ▪ Mul&ple ¡queries ¡(master-­‑detail-­‑detail, ¡etc.)? ¡ ▪ Using ¡images ¡as ¡Blobs ¡or ¡via ¡URLs? ¡

Discussion ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 60

slide-61
SLIDE 61

► Use ¡a ¡pragma&c ¡approach, ¡use ¡what ¡is ¡already ¡there ¡=> ¡URL ¡based ¡integra&on ¡ using ¡an ¡exis&ng ¡infrastructure. ¡ ► I ¡always ¡like ¡to ¡ques&on ¡whether ¡you ¡actually ¡NEED ¡PDF, ¡MS ¡Word ¡or ¡true ¡MS ¡ Excel, ¡because ¡it ¡is ¡difficult ¡and ¡costly. ¡ ► Crea&ng ¡a ¡pixel ¡perfect ¡design ¡for ¡PDF ¡is ¡PAINFUL. ¡

Discussion ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 61

slide-62
SLIDE 62

Q&A ¡

25.03.2014 Reporting Solutions for Oracle APEX Page 62

Dietmar ¡Aust ¡ Opal-­‑Consul&ng, ¡Köln ¡ ¡ www.opal-­‑consul&ng.de ¡ daust.blogspot.com ¡ dietmar.aust@opal-­‑consul&ng.de ¡