Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

oracle print report directly

Posted on 2014-03-27
14
Medium Priority
?
667 Views
Last Modified: 2014-04-03
hi
i have one form , having 4 text items , to fill in the 4 parameters required to run a report
here is the when button pressed trigger
declare
	X PARAMLIST;

BEGIN  	

	 X := CREATE_PARAMETER_LIST('T1');
	 add_parameter(x, 'ParamForm', TEXT_PARAMETER,'no');
	  
 	
       

	-- add_parameter(x, 'ParamForm', TEXT_PARAMETER,'yes');
  ADD_PARAMETER(X,'uac',TEXT_PARAMETER,:BASIC_BLOCK.UP_ACC);
  ADD_PARAMETER(X,'wdate1',TEXT_PARAMETER,:BASIC_BLOCK.D_from);
  ADD_PARAMETER(X,'wdate2',TEXT_PARAMETER,:BASIC_BLOCK.D_TO);
  ADD_PARAMETER(X,'wyear',TEXT_PARAMETER,:BASIC_BLOCK.T_YEAR);
 
        
           RUN_PRODUCT(REPORTS,'E:\MyOracle\Projects\GL_INt\gl6001_6.rep',SYNCHRONOUS,RUNTIME,FILESYSTEM,X);
          DESTROY_PARAMETER_LIST('T1');	
END;

Open in new window


every time i have to change the field :BASIC_BLOCK.UP_ACC  TO SELECT ANOTHER VALUE then run the report
i want to save time , the values of UP_ACC i can find it from one table
so , could i use cursor to loop in that table , then let the command send the report directly to the printer , then next value , print , then next , print , till the end of the cursor
0
Comment
Question by:NiceMan331
  • 8
  • 5
14 Comments
 
LVL 16

Expert Comment

by:Wasim Akram Shaik
ID: 39960854
I assume that your form has a provision to provide one input at a time,

why don't you increase the input parameter limit in the first place, that would suffice your requirement without any modifications.
0
 

Author Comment

by:NiceMan331
ID: 39961472
actually the report built to run one parameter for field up_acc
to increase the fields as per what you adviced , the report should be adjust to group by above up_acc . then in form we can select from up_acc to up_acc
but i can't adjust the report right now , i don't know how to group it above , then i have no extra time to do it , the easier way for me now is to find a way to print the report to printer directly ,
0
 
LVL 35

Expert Comment

by:Mark Geerlings
ID: 39962107
It looks to me like the best option would be to change the report to use the cursor loop and process each record it finds.  

If, for some reason, you don't want to (or can't?) change the report now, you could change your form block to be based on a table (or view) then have the form block execute the query.  Then, move the logic that you have now in a when-button-pressed trigger to a post-query trigger.  (This will cause a lot more server, database and network load, than if you could change the report to run the query and process multiple records in just one call Oracle Reports.  But, this is a way to save some user time.)
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:NiceMan331
ID: 39962327
Ok , i likes to change the form to be based on query , but is there any way to send the report directly to the printer ? Instead of preview
0
 
LVL 35

Expert Comment

by:Mark Geerlings
ID: 39962604
Yes, there is another parameter that you can add to your parameter_list and pass to the report that will cause the output to be printed directly, and not displayed in the previewer.  I don't remember what that parameter_name is, or the value that it needs, but I remember that was possible in Forms6/Reports6.  I'll see if I get a chance to check one of our old forms today to see what that value was, but I'm getting close to the end of my work day here.
0
 

Author Comment

by:NiceMan331
ID: 39962635
ok
waiting for you
0
 
LVL 35

Accepted Solution

by:
Mark Geerlings earned 2000 total points
ID: 39962710
Try adding these two parameters to your paramlist:
DESTYPE=PRINTER
DESNAME=[a valid printer on your system]

like this:

ADD_PARAMETER(X,'DESTYPE',TEXT_PARAMETER,'PRINTER');
ADD_PARAMETER(X,'DESNAME',TEXT_PARAMETER,'MyPrinter');

(Maybe 'DESTYPE' and 'DESNAME' need to be specified without the single quotes - I'm not sure.  I just checked the Reports6i "Help" file, I didn't actually find a working example.)
0
 

Author Comment

by:NiceMan331
ID: 39963835
i will try it tomorrow
thanx
0
 

Author Comment

by:NiceMan331
ID: 39965935
yes , it is ok now , it sent to the printer directly
now i will adjust the code to use cursor to loop all accounts
to check if sent all to the printer
0
 

Author Comment

by:NiceMan331
ID: 39966026
i have in the form 2 radio groups to select report name
another 2 radio groups to select printing mode , preview or printer

declare
	X PARAMLIST;
  CURSOR C_ACC IS
  SELECT ACC_NO FROM ACC_MASTER_FILE WHERE A_TYPE = 1;
  v_acc  C_ACC%rowtype;
  
BEGIN  	

X := CREATE_PARAMETER_LIST('T1');
if :BASIC_BLOCK.PRINT_REP = 1 then    -- select  1st report from option group


	 
	 add_parameter(x, 'ParamForm', TEXT_PARAMETER,'no');
	  
IF :BASIC_BLOCK.RAD_PRNT_MOD = 1 THEN   	-- select to print preview
       


  ADD_PARAMETER(X,'uac',TEXT_PARAMETER,:BASIC_BLOCK.UP_ACC);
 ADD_PARAMETER(X,'wdate1',TEXT_PARAMETER,:BASIC_BLOCK.D_from);
  ADD_PARAMETER(X,'wdate2',TEXT_PARAMETER,:BASIC_BLOCK.D_TO);
  ADD_PARAMETER(X,'wyear',TEXT_PARAMETER,:BASIC_BLOCK.T_YEAR);
  RUN_PRODUCT(REPORTS,'E:\MyOracle\Projects\GL_INt\gl6001_6.rep',SYNCHRONOUS,RUNTIME,FILESYSTEM,X);
ELSE IF :BASIC_BLOCK.RAD_PRNT_MOD = 2 THEN   	-- select printer
	
     
                	 ADD_PARAMETER(X,'DESTYPE',TEXT_PARAMETER,'PRINTER');
ADD_PARAMETER(X,'DESNAME',TEXT_PARAMETER,'HP LaserJet P2015 Series PCL 6');
 ADD_PARAMETER(X,'wdate1',TEXT_PARAMETER,:BASIC_BLOCK.D_from);
  ADD_PARAMETER(X,'wdate2',TEXT_PARAMETER,:BASIC_BLOCK.D_TO);
  ADD_PARAMETER(X,'wyear',TEXT_PARAMETER,:BASIC_BLOCK.T_YEAR);
  
	OPEN C_ACC;
	 loop
        	
         fetch C_ACC into v_acc;
         
         exit when C_ACC%notfound;
       
  

  ADD_PARAMETER(X,'uac',TEXT_PARAMETER,v_acc.ACC_NO);
  RUN_PRODUCT(REPORTS,'E:\MyOracle\Projects\GL_INt\gl6001_6.rep',SYNCHRONOUS,RUNTIME,FILESYSTEM,X);
	
  	  end loop;
     	
       CLOSE C_ACC;
end if;
end if;
end if;        
           
         
if :BASIC_BLOCK.PRINT_REP = 2 then   -- select another report
	
		 add_parameter(x, 'ParamForm', TEXT_PARAMETER,'yes');
  ADD_PARAMETER(X,'P3',TEXT_PARAMETER,15121);
 
         RUN_PRODUCT(REPORTS,'E:\MyOracle\Projects\GL_INt\Acct_Stat_Amt.rep',SYNCHRONOUS,RUNTIME,FILESYSTEM,X);
end if;


	
	 DESTROY_PARAMETER_LIST('T1');	
END;

Open in new window


the problem is , when selecting to print to the printer
it say parameter
ADD_PARAMETER(X,'uac',TEXT_PARAMETER,v_acc.ACC_NO);
already exist ,
shall i destroy the parametr lists withing the loop ?
2- is there additional choices to select no of copies , and page ranges ?
0
 
LVL 35

Expert Comment

by:Mark Geerlings
ID: 39966462
You cannot add the same parameter again to your parameter list inside a cursor loop.  So, your options are either:
1. Find a way to get this job by calling the report only once.
2. Destroy and recreate the parameter list inside your cursor loop.
0
 

Author Comment

by:NiceMan331
ID: 39967142
2- is there additional choices to select no of copies , and page ranges ?
0
 
LVL 35

Expert Comment

by:Mark Geerlings
ID: 39967160
Number of copies ? I think so.  Reports6 supports a parameter named: "COPIES".
Page ranges?  I doubt it.
0
 

Author Closing Comment

by:NiceMan331
ID: 39975130
sorry for delay , but i lost the internet connection in my office
i wish you try to fond a way for determine page ranges
thanx
0

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious sideā€¦
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question