J2EE for Oracle Technologists

advertisement
Tips and Tricks for
Customizing Portal Reports
Portlet Modules
Visit the Quovera
table for more info.
Peter Koletzke
Technical Director &
Principal Instructor
Second Law of Serendipity
If you wish to make an
improved product, you must
already be engaged in
making an inferior one.
2
Survey
• Oracle Portal work
– Portal reports?
– Dynamic pages?
– Portal forms?
– Calling Oracle Developer
forms (FMBs)?
– Calling Oracle Developer
reports (RDF)?
– Calling J2EE apps?
3
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)
4
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
5
Portal Reports Runtime
App Server
iAS
Database
Browser
Portal
link
Procedure
call URL
Report
package
mod_plsql
Parameter
Form
Reports
Runtime
Run
Report
results
(HTML,
PDF)
Reports
Servlet
Reports
RDF file
cgicmd.dat
Business
Database
Tables
and
views
scottcgi: userid= "scott/tiger@orcl" %*
6
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
7
Agenda
• Reports Portlet overview
• Creating the definition - annotated
• Tips, gotchas, workarounds
• Alternatives to Reports Portlet
8
Creating a Definition
•
Find Reports Definition portlet
–
•
In Builder (Reports Security) or in the Portlet list
Click Create Reports Definition File Access
9
Creating the Definition – Page 1
10
Creating the Definition – Page 2
11
Creating the Definition – Page 3
Desformat
Create this beforehand
12
Creating the Definition – Page 4
Create this beforehand
13
Tips for Creating the LOV
Do this before starting the Reports definition wizard
Must be “No”
for reports
This is ignored
for reports. Only
poplists are available
Use this for a “blank” item.
Needs a value. NULL won’t work
for reports (will work for
Portal reports and forms).
14
Creating the Definition – Page 5
Interesting idea
15
Creating the Definition – Page 6
Finish generates
the report PL/SQL
package.
This is ignored
Note: Every time you save a
report definition, Portal
rewrites the PL/SQL package.
16
Creating a Link – Page 1
• Click Add Item in a page group page
17
Creating a Link – Page 2
At Runtime
18
Agenda
• Reports Portlet overview
• Creating the definition - annotated
• Tips, gotchas, workarounds
• Alternatives to Reports Portlet
19
Visit the Customize Page
20
Notice the template
Customize Page
Desformat?
Check the parameters
to display. Click Save
Parameters (this also
saves the values you
place here).
Database
connection
token
stored in
oracle_
home/
reports/
conf/
cgicmd.dat
Be careful of values in
non-displayed
parameters.
LOV
21
• Desformat? Click
the New Link
• Where’s my
template?
• How do I get rid
of Builder and
Navigator links?
• How do I remove
the Schedule
tab?
• Can I add a
prompt hint?
• How do I change
the buttons?
• Can I show the
report name?
22
Builder
23
Navigator
24
As a Review: The Customize Page
25
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)
Still true as of 10g R2
– 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
26
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
Documented
on MetaLink.
– 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
27
New Prompt
28
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
29
New Parameter Form
• No Desformat
• Report title
• No Builder
and Navigator
links
• Your template
• Modified
buttons
• No schedule
tab
• Hints on
prompts
30
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
31
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, then
click Close
– Releases
Edit mode
32
Other
Methods –
JavaScript
Self-reducing
poplist
Auto-selected
poplist value. Use
this to default a
parameter value
or to remove a value.
Hide and display
fields dynamically
Use the same embedded
HTML technique for
separator lines.
33
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
34
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
35
Agenda
• Reports Portlet overview
• Creating the definition - annotated
• Tips, gotchas, workarounds
• Alternatives to Reports Portlet
36
Dynamic Page
Shuttle control.
Same technique used
for multi-select
control.
37
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
38
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
39
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?
40
Law of Probable Dispersal
Whatever it is that hits the
fan will not be evenly
distributed.
—Anonymous
41
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 lowlevel 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
42
Designer
Handbook
Developer
Advanced
Forms & Reports
JDeveloper 3
Handbook
ORACLE9i
JDeveloper
Handbook
ORACLE
JDeveloper 10g
Handbook
Also co-authored
with Avrom Roy-Faderman
 Please fill out the evals
 Books co-authored with Dr. Paul Dorsey
 Personal web site:
http://ourworld.compuserve.com/
homepages/Peter_Koletzke
http://www.quovera.com
• 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
43
Download