tips and tricks for customizing portal reports portlet modules peter koletzke technical director...
TRANSCRIPT
Tips and Tricks for Customizing Portal Reports Portlet Modules
Peter KoletzkeTechnical Director & Principal Instructor
Visit the Quovera table for more info.
2
If you wish to make an improved product, you
must already be engaged in making an inferior one.
Second Law of Serendipity
3
Survey
• Oracle Portal work– Portal reports?– Dynamic pages?– Portal forms?– Calling Oracle Developer
forms (FMBs)?– Calling Oracle Developer
reports (RDF)?– Calling J2EE apps?
4
Agenda
• Reports Portlet overview
• Creating the definition - annotated
• Tips, gotchas, workarounds
• Alternatives to Reports Portlet
Note: Sample code files available in the presentation zip file on the Quovera and
NoCOUG website.
Releases: 9i (9.0.2),
10g R1 (9.0.4),10g R2 (10.1.2)
5
Portal Reports Portlet Basics• Call RDF files from a Portal link
– “Report Definition File Access” • The Portal name
– Validates security of user– Presents a parameter form
• Text fields• LOVs (poplists)
• Report definition created in Portal development screens– Generates PL/SQL package to display
parameter form and to call Reports Server
6
BusinessDatabase
Portal Reports RuntimeiAS
Database
mod_plsql
Browser
ReportsServlet
Portal link Report
package
Procedure call URL
Parameter Form
Reports RDF file
cgicmd.datscottcgi: userid= "scott/tiger@orcl" %*
ReportsRuntime
Run
Report results (HTML, PDF)
Tables and
views
App Server
7
Creating the Definition• Create custom template first
– Use your logos and design elements– This is not used at runtime by default
• Also create LOVs in Portal– Use them on the report Parameters page
• Two methods for creating the definition– Copy an existing report definition
• Use the Manage tab of the Manage page• Parameter values are not copied
– Reset the values on the Customize page
– Create one from scratch • Screens follow
8
Agenda
• Reports Portlet overview
• Creating the definition - annotated
• Tips, gotchas, workarounds
• Alternatives to Reports Portlet
9
Creating a Definition• Find Reports Definition portlet
– In Builder (Reports Security) or in the Portlet list
• Click Create Reports Definition File Access
10
Creating the Definition – Page 1
11
Creating the Definition – Page 2
12
Creating the Definition – Page 3
Create this beforehand
Desformat
13
Creating the Definition – Page 4
Create this beforehand
14
Tips for Creating the LOV
This is ignoredfor reports. Only
poplists are available
Must be “No”for reports
Use this for a “blank” item. Needs a value. NULL won’t
work for reports (will work for Portal reports and forms).
Do this before starting the Reports definition wizard
15
Creating the Definition – Page 5
Interesting idea
16
Creating the Definition – Page 6
This is ignored
Finish generatesthe report PL/SQL
package.
Note: Every time you save a report definition, Portal
rewrites the PL/SQL package.
17
Creating a Link – Page 1 • Click Add Item in a page group page
18
Creating a Link – Page 2
At Runtime
19
Agenda
• Reports Portlet overview
• Creating the definition - annotated
• Tips, gotchas, workarounds
• Alternatives to Reports Portlet
20
Visit the Customize Page
21
Check the parameters to
display. Click Save Parameters (this also saves the values you
place here).
Be careful of values in non-displayed
parameters.
LOV
Database connection
token stored inoracle_ home/
reports/ conf/
cgicmd.dat
Desformat?
Customize PageNotice the template
22
Click the New Link
• Where’s my template?
• How do I get rid of Builder and Navigator links?
• Can I show the report name?
• How do I remove the Schedule tab?
• Can I add a prompt hint?
• How do I change the buttons?
• Desformat?
23
Builder
24
Navigator
25
As a Review: The Customize Page
26
Layout Gotchas• Layout is very basic
– Fields are laid out in a single column– Fields can only be text items or pulldown lists (poplists)– No popup LOV windows or shuttle controls– Field prompts are very basic
• The template you define will not be used at runtime (only on the Customize page)– Oracle template used (Oracle logos and copyright)– Builder and Navigator links displayed
• Users can see development areas
• No declarative way to change the button labels that a user sees– Portlet defaults are Apply, OK, Cancel– Huh?
• Desformat prompt cannot be defined
Still true as of 10g R2
27
Changing The DESFORMAT Prompt
• Prompt is stored in internal Portal table– WWNLS_STRINGS$– Protected by a policy (you can’t update it)
• Technique to make the change– Identify the subscriber ID and ID– Run a procedure that disables policies,
updates the table, and enables policies
• Sample: – desformat_prompt.sql
• Global to all reports
Documentedon MetaLink.
28
New Prompt
29
For Other Changes, Modify the Reports Definition Package Code
• Back up the package code first– If you edit the report definition later, you will need to
reapply the modifications
• Changing code in various procedures– show_tabpage and show_parms_internal– Samples in report_package_edits.txt
• Also, adding buttons to the template– Sample in industrial_template_buttons.txt
• Set the access method (item or parent) before starting– This changes the package code
30
New Parameter Form• Report title
• Modified buttons
• No schedule tab
• Hints on prompts
• No Builder and Navigator links
• Your template
• No Desformat
31
Validating Parameters
• Validation Trigger page 6 does not do anything
• Post-generation change– In the report database package body, find the
show procedure– After calls to validity_check(), add a validation
block that adds error messages– You need to do your own date format checking– Sample in validity_check.sql
• If you edit and save a change to the report definition, this is overwritten
32
Tip: Releasing Edit Mode• Click Edit from the Manage page
• Click Back– Report definition is now in Edit mode– No one else
can edit it– To fix, click
Edit, thenclick Close
– ReleasesEdit mode
33
Other Methods – JavaScript Self-reducing
poplist
Auto-selected poplist value. Usethis to default aparameter value
or to remove a value.
Use the same embedded HTML technique for
separator lines.
Hide and displayfields dynamically
34
JavaScript Code Required
• onLoad() function on the BODY tag in the template– JavaScript added to report package code– Default poplist selection– Disable or hide items
• Poplist selection changes the display– Self-reducing poplists (country/state-province) –
add code to report package– Hide fields and display fields based on
poplist value
• Sample in magic_providers.html
35
Limiting the Query Based on User
• Database user for Reports connection defined by the cgicmd.dat servlet key
• To associate a user with the session, get the Portal user – wwctx_api.get_user
• Pass the user as a Reports parameter• Add that parameter to the query
– Or set the user name into a context and read the context in a database VPD policy function
• Sample for setting the parameter in validity_check.sql
36
Agenda
• Reports Portlet overview
• Creating the definition - annotated
• Tips, gotchas, workarounds
• Alternatives to Reports Portlet
37
Dynamic Page
Shuttle control.Same technique used for multi-
selectcontrol.
38
Code Required• Portal dynamic page – not Reports portlet
– Calls a package that builds the page a line at a time• Layout capabilities are unlimited
– Multi-column– Any stylesheet style– Unlimited JavaScript capabilities
• All code is up to you– Code it in HTML first– Run WebAlchemy for starting code
• http://www.users.bigpond.com/ahobbs/
• Samples– demo_shuttle.html – demo_dyn_form.txt
39
UIX Form• UIX parameter form calling reports server
– View object for parameter fields
• The trick is working out the URL– Examine the URL from other working reports
• SSO will protect the content– Report package not needed for that
• Create Struts action to interpret the Run button click– Retrieve elements from binding to get
parameter values– Build up the URL with parameter values– Sample URL in sample_url.txt
40
HTML DB
• Hot new kid on the block
• You can develop reports with it– PL/SQL based as is Portal reports
• Same for forms
• Can call Reports RDF files– No native feature yet– Apparently documented on OTN
• Anyone done this?
41
Whatever it is that hits the fan will not be evenly
distributed.
—Anonymous
Law of Probable Dispersal
42
Summary• The Portal Reports Portlet works but its
user interface is very basic• If you use it, you need to apply
workarounds to the portlet bugs• Some customizations require some low-
level code modifications– Keep backups of the packages– Don’t tell Oracle Support
• Consider dynamic pages instead– Or UIX pages or Portal forms or
HTML DB
43
DesignerHandbook
DesignerHandbook
DeveloperAdvancedForms & Reports
DeveloperAdvancedForms & Reports
JDeveloper 3HandbookJDeveloper 3Handbook
ORACLE9iJDeveloperHandbook
• Founded in 1995 as Millennia Vision Corp.
• Profitable for 7+ years without outside funding
• Consultants each have 10+ years industry experience
• Strong High-Tech industry background• 200+ clients/300+ projects• JDeveloper Partner• More technical white papers and
presentations on the web site
http://www.quovera.com
Books co-authored with Dr. Paul Dorsey Personal web site:
http://ourworld.compuserve.com/ homepages/Peter_Koletzke
ORACLEJDeveloper 10gHandbook
Also co-authoredwith Avrom Roy-Faderman
Please fill out the evals