Home » Developer & Programmer » Forms » Call several reports from a button-pressed form
icon9.gif  Call several reports from a button-pressed form [message #256134] Fri, 03 August 2007 02:06 Go to next message
scosco
Messages: 12
Registered: July 2007
Location: Port louis
Junior Member
hi..i want to call several reports from a button pressed form...plz help...i work on oracle 10g server sun6,Actually the code which i use for 1 report is as follows:Plzz helep



DECLARE
v_report_id Report_Object;
vc_ReportServerJob VARCHAR2(100);
vc_rep_status VARCHAR2(100);
vjob_id VARCHAR2(100);
varstcashid varchar(35);
varstsite varchar(5);


BEGIN


v_report_id := FIND_REPORT_OBJECT('REP_PAYR006');

SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_COMM_MODE,SYNCHRONOUS);

SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_DESTYPE,cache);

SET_REPORT_OBJECT_PROPERTY(v_report_id, REPORT_FILENAME, 'C:\CMSWEB\payr006.jsp');

SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_DESFORMAT,'PDF');

SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_SERVER,'rep_sarah');

varstcashid:='"'||:stcashid||'"';
varstsite:='"'||:stsite||'"';


SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_OTHER,'ST_CASH_ID='||varstcashid||' ST_DATE='||:stdate||' ST_SITE='||varstsite||' paramform=no' ||' copies=2');


vc_ReportServerJob := RUN_REPORT_OBJECT(v_report_id);


vjob_id := substr(vc_ReportServerJob,length('rep_sarah')+2,length(vc_ReportServerJob));


vc_rep_status := REPORT_OBJECT_STATUS(vc_ReportServerJob);

IF vc_rep_status = 'FINISHED' THEN
WEB.SHOW_DOCUMENT ('/reports/rwservlet/getjobid'|| vjob_id||'?server=rep_sarah','_blank');
ELSE
message ('Report failed with error message '||vc_rep_status);

END IF;

END;
Re: Call several reports from a button-pressed form [message #256137 is a reply to message #256134] Fri, 03 August 2007 02:12 Go to previous messageGo to next message
gaurav.mcabanti
Messages: 5
Registered: May 2007
Junior Member
u wnana to run all this reports simultneously....???????
Re: Call several reports from a button-pressed form [message #256142 is a reply to message #256137] Fri, 03 August 2007 02:26 Go to previous messageGo to next message
scosco
Messages: 12
Registered: July 2007
Location: Port louis
Junior Member
hi..no not simultanesouly.one by one..when one report is closed..another one opens..i have 4 reports in all...do u have any glue??by the way i've search the whole orafaq but i cant find any solution..

[Updated on: Fri, 03 August 2007 02:27]

Report message to a moderator

icon9.gif  Re: Call several reports from a button-pressed form [message #256556 is a reply to message #256134] Mon, 06 August 2007 00:17 Go to previous messageGo to next message
scosco
Messages: 12
Registered: July 2007
Location: Port louis
Junior Member
PLZZZZZZZZZZZ i really need help........................................

Call several reports from a button-pressed form
Re: Call several reports from a button-pressed form [message #256621 is a reply to message #256134] Mon, 06 August 2007 02:28 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Please use 'code' tags to make your post more readable.

I strongly recommend getting rid of the 'run_report_object' code and only use the 'web.show_document' command.

You have successfully written and run one report, right? Well, use the same 'web.show_document' code to run the other three reports in the same trigger. It should work.

David
Re: Call several reports from a button-pressed form [message #256934 is a reply to message #256621] Tue, 07 August 2007 03:29 Go to previous messageGo to next message
scosco
Messages: 12
Registered: July 2007
Location: Port louis
Junior Member
Hi david,thx for ur advice..i have been able to run 3 reports simultenously..
The following code (ive tried to arrange it wix tags but in orafaq doesnt appear) is below. However i still have some problems
1. when I treid to get rid of the run_report_object,it doesnot work,can u help me on the code plz..
2. I wanted to use a loop to run the different reports instaed of repeating the code SET_REPORT_OBJECT_PROPERTY 3 times,is that possible?
3. I dont want to run all the reports simultenously but one by one..when one is closed another one opens on format pdf.Is that possible.

thx once more david.

DECLARE
v_report_id Report_Object;
v_report_id2 Report_Object;
v_report_id3 Report_Object;

vc_ReportServerJob VARCHAR2(100);
vc_ReportServerJob2 VARCHAR2(100);
vc_ReportServerJob3 VARCHAR2(100);

vc_rep_status VARCHAR2(100);
vc_rep_status2 VARCHAR2(100);
vc_rep_status3 VARCHAR2(100);

vjob_id VARCHAR2(100);
vjob_id2 VARCHAR2(100);
vjob_id3 VARCHAR2(100);

varstcashid varchar(35);
varstsite varchar(5);

BEGIN

v_report_id := FIND_REPORT_OBJECT('REP_PAYR006');
v_report_id2 := FIND_REPORT_OBJECT('REP_PAYR007');
v_report_id3 := FIND_REPORT_OBJECT('REP_PAYR008');


SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_COMM_MODE,SYNCHRONOUS);
SET_REPORT_OBJECT_PROPERTY(v_report_id2,REPORT_COMM_MODE,SYNCHRONOUS);
SET_REPORT_OBJECT_PROPERTY(v_report_id3,REPORT_COMM_MODE,SYNCHRONOUS);

SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_DESTYPE,cache);
SET_REPORT_OBJECT_PROPERTY(v_report_id2,REPORT_DESTYPE,cache);
SET_REPORT_OBJECT_PROPERTY(v_report_id3,REPORT_DESTYPE, cache);
(v_report_id3,REPORT_DESTYPE,cache);
SET_REPORT_OBJECT_PROPERTY(v_report_id3,REPORT_DESTYPE, cache);


SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_DESFORMAT,'PDF');
SET_REPORT_OBJECT_PROPERTY(v_report_id2,REPORT_DESFORMAT,'PDF');
-- SET_REPORT_OBJECT_PROPERTY(v_report_id3,REPORT_DESFORMAT,'PDF');

SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_SERVER,'rep_sarah');
SET_REPORT_OBJECT_PROPERTY(v_report_id2,REPORT_SERVER,'rep_sarah');
-- SET_REPORT_OBJECT_PROPERTY(v_report_id3,REPORT_SERVER,'rep_sarah');

varstcashid:='"'||:stcashid||'"';
varstsite:='"'||:stsite||'"';


SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_OTHER,'ST_CASH_ID='||varstcashid||' ST_DATE='||:stdate||' ST_SITE='||varstsite||' paramform=no' ||' copies=2');
SET_REPORT_OBJECT_PROPERTY(v_report_id2,REPORT_OTHER,'ST_CASH_ID='||varstcashid||' ST_DATE='||:stdate||' ST_SITE='||varstsite||' paramform=no' ||' copies=5');

SET_REPORT_OBJECT_PROPERTY(v_report_id3,REPORT_OTHER,'ST_CASH_ID='||varstcashid||' ST_DATE='||:stdate||' ST_SITE='||varstsite||' paramform=no' ||' copies=1');

vc_ReportServerJob := RUN_REPORT_OBJECT(v_report_id);
vc_ReportServerJob2 := RUN_REPORT_OBJECT(v_report_id2);
vc_ReportServerJob3 := RUN_REPORT_OBJECT(v_report_id3);

vjob_id := substr(vc_ReportServerJob,length('rep_sarah')+2,length(vc_ReportServerJob));
vjob_id2 := substr(vc_ReportServerJob2,length('rep_sarah')+2,length(vc_ReportServerJob2));
vjob_id3 := substr(vc_ReportServerJob3,length('rep_sarah')+2,length(vc_ReportServerJob3));


vc_rep_status := REPORT_OBJECT_STATUS(vc_ReportServerJob);
vc_rep_status2 := REPORT_OBJECT_STATUS(vc_ReportServerJob2);
vc_rep_status3 := REPORT_OBJECT_STATUS(vc_ReportServerJob2);

IF vc_rep_status = 'FINISHED' THEN
WEB.SHOW_DOCUMENT ('/reports/rwservlet/getjobid'|| vjob_id||'?server=rep_sarah','_blank');
ELSE
message ('Report failed with error message '||vc_rep_status);
END IF;

IF vc_rep_status = 'FINISHED' THEN
WEB.SHOW_DOCUMENT ('/reports/rwservlet/getjobid'|| vjob_id2||'?server=rep_sarah','_blank');
ELSE
message ('Report failed with error message '||vc_rep_status);
END IF;

IF vc_rep_status = 'FINISHED' THEN
WEB.SHOW_DOCUMENT ('/reports/rwservlet/getjobid'|| vjob_id3||'?server=rep_sarah','_blank');
ELSE
message ('Report failed with error message '||vc_rep_status);
END IF;



END;

[Updated on: Tue, 07 August 2007 03:40]

Report message to a moderator

Re: Call several reports from a button-pressed form [message #257282 is a reply to message #256934] Wed, 08 August 2007 00:27 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Concerning point 1 have a look at http://www.orafaq.com/forum/m/144539/67467/?srch=web.show_document#msg_144539

Point 2 How about using the same Report_Object and inside the loop you build the report name or use a local array for the report names? Just put a loop around the whole body of code and execute the number of times there are entries in the report name array.

Point 3 as soon as you do that, the user will ask for the reports to be shown side by side. If you want the report server to only run one report at a time then make the queue width smaller.

David
Re: Call several reports from a button-pressed form [message #257774 is a reply to message #257282] Thu, 09 August 2007 02:46 Go to previous messageGo to next message
scosco
Messages: 12
Registered: July 2007
Location: Port louis
Junior Member
wow..about the point 2, I dont know how to create an array where to put the report names..im new to oracle Embarassed ...kan u help me on that...


COncerning point 3...it seems more difficult but im working on it all..
tk
Re: Call several reports from a button-pressed form [message #257833 is a reply to message #257774] Thu, 09 August 2007 05:25 Go to previous messageGo to next message
scosco
Messages: 12
Registered: July 2007
Location: Port louis
Junior Member
ive tried to create an an array to put the following reports but it still doesnot wok.Kan anyone help me on that.


BEGIN


/*Point 2 How about using the same Report_Object and inside the loop you build the report name or use a local array for
the report names? Just put a loop around the whole body of code and execute the number of times there are
entries in the report name array.*/

FOR i IN 1..4 LOOP

Tab(1):='REP_PAYR005';
Tab(2):='REP_PAYR006';
Tab(3):='REP_PAYR007';
Tab(4):='REP_PAYR008';

v_report_id := FIND_REPORT_OBJECT('Tab(i)');
SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_COMM_MODE,SYNCHRONOUS);
SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_DESTYPE,cache);
SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_DESFORMAT,'PDF');
SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_SERVER,'rep_sarah');
SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_OTHER,'ST_CASH_ID='||varstcashid||' ST_DATE='||:stdate||' ST_SITE='||varstsite||' paramform=no' ||' copies=1');

vc_ReportServerJob := RUN_REPORT_OBJECT(v_report_id);
vc_rep_status := REPORT_OBJECT_STATUS(vc_ReportServerJob);
vjob_id := substr(vc_ReportServerJob,length('rep_sarah')+2,length(vc_ReportServerJob));

IF vc_rep_status = 'FINISHED' THEN
WEB.SHOW_DOCUMENT ('/reports/rwservlet/getjobid'|| vjob_id||'?server=rep_sarah','_blank');
ELSE
message ('Report failed with error message '||vc_rep_status);
END IF;

END LOOP;

end;

[Updated on: Thu, 09 August 2007 05:38]

Report message to a moderator

Re: Call several reports from a button-pressed form [message #258026 is a reply to message #257833] Thu, 09 August 2007 18:59 Go to previous message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Have a look at http://www.orafaq.com/forum/m/230700/67467/?srch=web.show_document+%27FINISHED%27#msg_230700 for how to 'loop' the 'REPORT_OBJECT_STATUS'.

But, again, I have communicated with Oracle and they will probably remove the use of 'RUN_REPORT_OBJECT' from future examples so that only the 'web.show_document' facility will be shown. I STRONGLY recommend that you ONLY use 'web.show_document' as it will AUTOMATICALLY start the report server if it is not running where 'run_report_object' DOES NOT.

Please use 'code' tags when posting code. From a coding point of view, one normally places the 'array load' BEFORE the beginning of the 'loop'.

David

PS you don't have to PM new to look at an entry in the Forms forum. I look at EVERY one ultimately, and will reply to those that I think have not been adequately answered (unless it deals with hierarchy tree about which I have no working experience).
Previous Topic: Global variable or Parameters
Next Topic: Vista and Oracle forms 6i
Goto Forum:
  


Current Time: Sun Dec 11 04:32:24 CST 2016

Total time taken to generate the page: 0.08121 seconds