P. 1
Oracle Reports Reference 6i

Oracle Reports Reference 6i

|Views: 5,094|Likes:
Published by PERSEUS_888

More info:

Published by: PERSEUS_888 on Sep 16, 2011
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

06/05/2013

pdf

text

original

Usage Notes Report Builder raises this exception when the SRW.RUN_REPORT
packaged procedure fails.

SRW.RUN_REPORT_FAILURE example

/* Suppose you want your own error message raised, instead of the
default
** error message (above). The following PL/SQL code raises a customized
** error message when SRW.RUN_REPORT_FAILURE is raised.
*/

EXCEPTION

WHEN srw.run_report_failure then

srw.message(30, ’Error mailing reports.’);

raise srw.program_abort;

Report Builder Reference

114

SRW.SET_ATTR

New Feature: It is now more convenient to set attributes using the Set Attributes
Procedures. SRW.SET_ATTR is still supported for compatibility, but it is highly
recommended that you use the simplified procedures.
Description SRW.SET_ATTR applies attribute settings such as font, size, or color to
layout objects. You specify formatting attributes with SRW.SET_ATTR in three steps:

1 Specify the attributes you wish to set (e.g., the border) by setting
SRW.ATTR.MASK.

2 Specify a value for each of the attributes that you specified in the previous step
(e.g., width of 1 character).

3 Apply the mask to the object by calling the SRW.SET_ATTR procedure.

Note: In most cases, you can define Web links (HTML or PDF) and HTML attributes in
an object’s Property Palette. If you require more complex implementation, such as
conditional settings, you must use SRW.SET_ATTR:

n

To specify Web links, use the ACTION, BOOKMARK, HYPERLINK, and
LINKTAG attributes.

n

To define HTML document and page headers and footers, use the
BEFPAGE_ESCAPE, AFTPAGE_ESCAPE, BEFREPORT_ESCAPE,
AFTREPORT_ESCAPE attributes.

n

To define HTML Parameter Form headers and footers, use the BEFFORM_ESCAPE
and AFTFORM_ESCAPE.

Syntax

SRW.ATTR.MASK := SRW.attr_ATTR [+ SRW.attr_ATTR. . .];
SRW.ATTR.attr := value; [SRW.ATTR.attr := value;. . .]
SRW.SET_ATTR (object_id, SRW.ATTR);

Parameters

attr

Is the name of the attribute that you are setting (e.g.,
BORDERWIDTH).

object_id

Is 0 or SRW.REPORT_ID. When setting the value of
BEFREPORT_ESCAPE, AFTREPORT_ESCAPE,
BEFPAGE_ESCAPE, and AFTPAGE_ESCAPE it is
SRW.REPORT_ID. In all other cases, it is 0.

value

Is a valid value for the attribute (e.g., 1 would be a a valid value
for BORDERWIDTH).

Report Builder Reference

115

SRW.SET_ATTR restrictions

n

If you specify an attribute (e.g., SRW.FILLPATT_ATTR), you must specify a value
for it. If you do not specify a value for a specified attribute, you will get
unpredictable results for that attribute.

n

If you specify a value that is not provided by the Report Builder package, it must be
a string (i.e., enclosed by single quotes). For example, a value for
SRW.ATTR.FORMATMASK must be enclosed by single quotes, because you may
specify any value. A value for SRW.ATTR.HJUST must not be enclosed by single
quotes, because you must specify one of the values that Report Builder provides.

n

Attributes for text can only be applied to fields via SRW.SET_ATTR. They cannot
be applied to boilerplate text. To change the text attributes of boilerplate text, use
the Format menu or the tool palette in the Layout editor.

SRW.SET_ATTR character mode example

/* Here’s an example of using all of the formatting
** attributes valid for character-mode reports.
** Notice that there are two values applied to the
** horizontal justification attribute (HJUST).
** Note: For the printer codes &1 and &2 to be
** meaningful, the printer definition file for
** this report must define what the printer should
** do for &1 and &2.
*/

function F_SALFormatTrigger return boolean is

begin

IF :SAL > 2000 THEN

SRW.ATTR.MASK := SRW.BEFCODE_ATTR +

SRW.AFTCODE_ATTR +

SRW.TEXT_ATTR +

SRW.FILLPATT_ATTR +

SRW.BORDERWIDTH_ATTR +

SRW.FORMATMASK_ATTR +

SRW.HJUST_ATTR;

SRW.ATTR.BEFCODE := ’&1’;

SRW.ATTR.AFTCODE := ’&2’;

SRW.ATTR.TEXT := SRW.BOLD_TEXTA;

SRW.ATTR.FILLPATT := ’TRANSPARENT’;

SRW.ATTR.BORDERWIDTH := 1;

SRW.ATTR.FORMATMASK := ’DD-MON-YY’;

SRW.ATTR.HJUST := SRW.CENTER_HJUST +

SRW.FLUSH_HJUST;

END IF;

Report Builder Reference

116

SRW.SET_ATTR(0, SRW.ATTR);

RETURN(TRUE);

end;

SRW.SET_ATTR format mask example

/* If the salary is 2000, the following code
** segment sets the format mask to -99990.
*/

function F_SALFormatTrigger return boolean is

begin

if :sal = 2000 then

srw.attr.mask := SRW.FORMATMASK_ATTR;

srw.attr.formatmask := ’-99990’;

srw.set_attr (0, srw.attr);

end if;

RETURN (TRUE);

end;

SRW.SET_ATTR set field color example

/* If the salary is 2000, this function sets the
** following attributes: border width to 1, foreground
** border color to "red," background border color
** to "blue," border pattern to "checker," foreground
** fill color to "yellow," background fill color to
** "green," and the fill pattern to "crisscross."
**
** Note: When you run the report with this PL/SQL
** construct in character mode, only the border width
** (of 1) and fill pattern (of solid) will be set;
** all other settings will be ignored. When you run
** the report with this PL/SQL construct in bitmap,
** all of the attributes will be set. (Be aware that
** the border background color cannot be set on some
** GUIs.)
*/

function F_SALFormatTrigger return boolean is

begin

if :sal = 2000 then

srw.attr.mask := SRW.BORDERWIDTH_ATTR +

SRW.FBCOLOR_ATTR +

SRW.BBCOLOR_ATTR +

SRW.BORDPATT_ATTR +

SRW.FFCOLOR_ATTR +

SRW.BFCOLOR_ATTR +

SRW.FILLPATT_ATTR;

srw.attr.borderwidth := 1;

srw.attr.fbcolor := ’red’;

srw.attr.bbcolor := ’blue’;

srw.attr.bordpatt := ’checker’;

srw.attr.ffcolor := ’yellow’;

Report Builder Reference

117

srw.attr.bfcolor := ’green’;

srw.attr.fillpatt := ’crisscross’;

srw.set_attr (0, srw.attr);

end if;

RETURN(TRUE);

end;

SRW.SET_ATTR set field text attributes example

/* If the salary is 2000, this function
** sets the following text attributes: text
** to bold, font to TIMES, size to 18 points,
** style to underline, weight to bold, text color
** to "blue," and the justification to center.
**
** Note: When you run the report with this PL/SQL
** construct in character mode, only the text will
** be set to bold (SRW.TEXT_ ATTR); all other
** attributes will be ignored. When you run the
** report with this PL/SQL construct in bitmap,

** all of the attributes--except SRW.TEXT_ATTR—will
** be set.
*/

function F_SALFormatTrigger return boolean is

begin

if :sal = 2000 then

srw.attr.mask := SRW.TEXT_ATTR +

SRW.FACE_ATTR +

SRW.SZ_ATTR +

SRW.WEIGHT_ATTR +

SRW.STYLE_ATTR +

SRW.GCOLOR_ATTR +

SRW.HJUST_ATTR;

srw.attr.text := SRW.BOLD_TEXTA;

srw.attr.face := 'times';

srw.attr.sz := 18;

srw.attr.weight := SRW.BOLD_WEIGHT;

srw.attr.style := SRW.UNDERLINE_STYLE;

srw.attr.gcolor := 'blue';

srw.attr.hjust := SRW.CENTER_HJUST;

srw.set_attr (0, srw.attr);

end if;

RETURN (TRUE);

end;

SRW.SET_ATTR vertical spacing example

/* If the salary is 2000, this function sets
** the vertical spacing between lines to a custom
** size of 200 VGS units. (One inch is equivalent
** to 8192 VGS units.)

Report Builder Reference

118

*/

function F_SALFormatTrigger return boolean is

begin

if :sal = 2000 then

srw.attr.mask := SRW.GSPACING_ATTR;

srw.attr.gspacing := SRW.CUSTOM_SPACING;

srw.attr.custom := 200;

srw.set_attr (0, srw.attr);

end if;

RETURN (TRUE);

end;

SRW.SET_ATTR example (switching printer trays)

/* The example below sets the printer tray in a Between Pages trigger.
*/

function BetweenPages return boolean is
begin

srw.attr.mask := SRW.PRINTER_INTRAY_ATTR;
srw.attr.printer_intray := ’letterhead’;
srw.set_attr(SRW.REPORT_ID, srw.attr);
return (TRUE);
end;

Report Builder Reference

119

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->