Say you have 2 fields in your report: field1 and field2 given by a query
select
field1, field2
from tbl.
So far you have a single group in the datamodel, say G_1.
Say you have parameter p_1, and if it equals 1 you want to group by field1, otherwise by field2.
1. In the group where field1 and field2 are define calculated field cf_1 with the following formula:
function CF_1Formula return Number is
begin
if _1 = 1 then return :field1;
else return :field2;
end if;
end;
2.Define the break order on cf_1 to be ascending.
3.Drag cf_1 in front of G_1 to form the new group G_CF_1.
4.Define your report as 2 repeating frames, one insede another. The source of outer frame to be G_CF_1, the source of inner one to be G_1.
5.Place cf_1 to the outer frame, field1, field2 to the inner one.
BEGIN
rg_id := Find_Group(rg_name);
IF Id_Null(rg_id) THEN
rg_id := Create_Group_From_Query(rg_name,'select styleid from styles
where styles.styleid =( select tnid from tna where PFAUDIT_DT = trunc(sysdate)+2
or
FAUDIT_DT = trunc(sysdate)+2
or
HO_DT = trunc(sysdate)+2)');
END IF;
errcode := Populate_Group(rg_id);
pl_id := get_parameter_list('rem');
if not id_null(pl_id) then
destroy_parameter_list(pl_id);
end if;
pl_id := create_parameter_list('rem');
add_parameter(pl_id,'rem',data_parameter,rg_name);
I don't think list parameters are supportet by Oracle Report. To do what you need use lexical parameter
select * from styles
where styles.styleid in &REM
and pass from your form for the REM parameter either a piece of sql, or explicit list. Any of those substituted for &REM should create meaningful report query.
For example, REM can be
(select field1 from TBL) -- subquery, or
('value1', 'value2', 'value3') -- list of values.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.