Home » Developer & Programmer » Reports & Discoverer » Dynamic display in Report
Dynamic display in Report [message #347609] Fri, 12 September 2008 05:47 Go to next message
aditiC
Messages: 38
Registered: February 2006
Location: INDIA
Member
The report needs to display only the fields selected while calling the report from a form. Suppose the report has 4 columns, but only 3 are selected while calling the report. So only the 3 selected column needs to be displayed and the report layout to be adjusted dynamically (i.e. no gapto be shown for the column not selected). I am new to reports. Kindly suggest something.

thanks,
Aditi
Re: Dynamic display in Report [message #347662 is a reply to message #347609] Fri, 12 September 2008 10:35 Go to previous message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Well, as far as I can tell, query should be the same all the time.

Report should know which columns are to be displayed. It can be done by storing this information into a table (so that report could see it), or by one (or more) parameter(s).

"One parameter" solution might contain some kind of a binary mask. For example, if there were 4 fields and you'd like to display fields 1, 3, 4 and hide field 2, mask would look like "1011".
Next, you'd create a format trigger for every field which would - using the SUBSTR function - check state of "its" bit of hide/display information. For example, field 3 format trigger might look like
  l_bit number(1);
begin
  select substr(:par_binary_mask, 3, 1) into l_bit
  from dual;
 
  return (l_bit = 1);
end;

Or, if possible, you could use this mask in the report query, as
SELECT 
  decode(substr(:par_binary_mask, 1, 1), 1, column_1, null) col_1,
  decode(substr(:par_binary_mask, 2, 1), 1, column_2, null) col_2,
  ...
from some_table
where ...


"More than one parameter" would, basically, do the same, but you'd check state of every parameter's value (which, in a case that query contains many records, would require (too?) many parameters).

Note that I didn't test it - it was just a pure theory.

Also, I have never created a report using the dynamic query which could (maybe) be transfered from a form to a report. For more information about such a solution wait for someone else's opinion.
Previous Topic: rep-1216 'F-2' has an illegal print condition
Next Topic: Problem - Aggregate (percentage) Column in a Crosstab
Goto Forum:
  


Current Time: Wed May 01 15:15:30 CDT 2024