Home » Developer & Programmer » Forms » call report from form
call report from form [message #162469] Fri, 10 March 2006 06:59 Go to next message
ritchielin
Messages: 5
Registered: March 2006
Junior Member
I created a report by using oracle report builder.
the codes are: SELECT equipment.equipment_id, equipment_schedule.equipment_id, function.function_no, equipment_schedule.function_no, equipment_name, function_name, function_date,equipment_schedule.r_quantity
FROM equipment, function, equipment_schedule
WHERE function.function_no = equipment_schedule.function_no
AND equipment.equipment_id = equipment_schedule.equipment_id
AND function_date between :function_date and :function_date_end;

and these codes are ok and can be run. i save it and name it as report1.rdf

but I am trying to call this report from oracle form(oracle form builder), i name the form (report) with code on the trigger:
DECLARE
repid REPORT_OBJECT; /* Report object ID for the report */
v_ReportServerJob VARCHAR2(100); /* unique job id for each Report reuqest*/
v_Rep_status varchar2(20); /* status of the Report job */
v_otherparam varchar2(100);
BEGIN
/* Get a handle to the Report Object itself. */
repid := find_report_object('usage');
v_otherparam:='paramform=no start_date='||:REPORT.start_date ||
'end_date='||:REPORT.end_date;
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_OTHER,v_otherparam);
/* Run the report and retrieve the v_ReportServerJob
as a handle to the report process */
v_ReportServerJob:= RUN_REPORT_OBJECT(repid);
/* If finished, check the report status . */
v_rep_status := REPORT_OBJECT_STATUS(v_ReportServerJob);
/* Display the Reports output to a separate browser window. */
IF v_rep_status='FINISHED' THEN
web.show_document('File://x:\qc303final\REPORT1.pdf','_blank');
ELSE
message ('Report failed with error message'||v_rep_status);
END IF;
END;


this form has two text field , one for start date and one for end date. they both under the block call (report)

but when i try to run it ,it gave me a pop up window saying" you did not specify name of the report" and a error message"FRM-40738:Argument to builtin REPORT_OBJECT_STATUS cannot be null"

can any one help me ASAP!
Re: call report from form [message #162552 is a reply to message #162469] Sat, 11 March 2006 02:42 Go to previous messageGo to next message
amolnk
Messages: 9
Registered: March 2006
Location: India
Junior Member
Try the following code in form's button pressed,
i'm assuming the report is on c:.

--
DECLARE
pl_id ParamList;
BEGIN
pl_id := Get_Parameter_List('plist');

IF NOT Id_Null(pl_id) THEN
Destroy_Parameter_List( pl_id );
END IF;

pl_id := Create_Parameter_List('plist');

Add_Parameter(pl_id,'function_date',TEXT_PARAMETER,:REPORT.start_date );
Add_Parameter(pl_id,'function_date_end',TEXT_PARAMETER,:REPORT.end_date);
Add_Parameter(pl_id, 'PARAMFORM', TEXT_PARAMETER, 'NO');

Run_Product(REPORTS, 'c:\report1.RDF', SYNCHRONOUS, RUNTIME, FILESYSTEM, pl_id, NULL);
end;
--
Re: call report from form [message #162860 is a reply to message #162469] Mon, 13 March 2006 22:32 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Next time use the code formatter at http://www.orafaq.com/utilities/sqlformatter.htm which is detailed in the sticky at the beginning of this forum. It makes it much easier to read.
DECLARE
  repid              report_object; /* Report object ID for the report */
   v_reportserverjob  VARCHAR2(100); /* unique job id for each Report reuqest*/
   v_rep_status       VARCHAR2(20); /* status of the Report job */
   v_otherparam       VARCHAR2(100);
BEGIN
/* Get a handle to the Report Object itself. */
  repid := Find_report_object('usage');
  
  v_otherparam := 'paramform=no start_date=' || :REPORT.start_date || 'end_date=' || :REPORT.end_date;
  
  Set_report_object_property(repid,
                             report_other,
                             v_otherparam);
  /* Run the report and retrieve the v_ReportServerJob as a handle to the report process */
  
  v_reportserverjob := Run_report_object(repid);
  /* If finished, check the report status . */
  
  v_rep_status := Report_object_status(v_reportserverjob);
  /* Display the Reports output to a separate browser window. */
  
  IF v_rep_status = 'FINISHED' THEN
    web.Show_document('File://x:\qc303final\REPORT1.pdf',
                      '_blank');
  ELSE
    Message('Report failed with error message' || v_rep_status);
  END IF;
END;

Next, search this forum for 'show_document' and you find http://www.orafaq.com/forum/m/144539/67467/?srch=web.show_document#msg_144539.

You will see that there are no spaces between the parameters when using the 'show_document' facility. Also, while the report is displayed as a PDF document, it is actually created as part of the 'show_document' process.

David
Previous Topic: list box
Next Topic: How to connect database from sql*plus with forms & How to solve ORA:12541:TNS: no listener error
Goto Forum:
  


Current Time: Fri Sep 20 06:39:48 CDT 2024