Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RUN_REPORT_OBJECT versus RUN_PRODUCT? 2

Status
Not open for further replies.

marcarls

Programmer
Feb 7, 2002
40
SE
Hi,
I am very new at this.
I have created reports in Oracle Reports (all with many inparameters). I now want to create a front end for my users, in Oracle Forms 6.i. I want to create forms from where parameters are passed on to Oracle Reports.

I am aware of the function RUN_PRODUCT but I dont know how to get the values from the form passed through to the report. I also wonder what RUN_REPORT_OBJECT is used for, should I use that function instead?

Does anyone have a suggestion?

Regards
 
hi,
if u want to pass param values from your form to report then ,i am assuming that u r calling the report from a button . the code behind the when_button_pressed trigger should be like this :
1.first with a built-in create parameter list(find the builtin inthe form builder help-may be create_parameter_list)
2.then with "add_parameter" add the parameter (which u want to pass to the report) with value,to the parameter list you created earlier.please remember,the parameter u r adding in the param list ,its name should be same like the parameter which is there in the report.
3.then use the run_product builtin and pass the parameterlist id or name of the parameter list with this builtin.
then u will find that the values for the parameter is passed to the report,u will find the values in the parameter form of the report (in the parameter field).
if u find any dificulty with this process please let me know with this thread i will try to help you further.


thanks...
 
Thank you "mehbub" :) It works fine to do that and I understood what you explained. My next problem is to create an interface where the user enters the information. I have not yet figured out how to get hold of the information in the text fields so I can use them in my function (thats how bad I am *smile*). And I also trying to figure out how to make a simple dropdown with values from the database. As it is now a new window pops up with values, and that is not really what I need.
Perhaps you have any smart quick tip for me :)
 
If u r calling the report from a button . the code behind the when_button_pressed trigger should be like this :

//
DECLARE
pl_id ParamList;
BEGIN
pl_id := Get_Parameter_List('mylist');
IF NOT Id_Null(pl_id) THEN
Destroy_Parameter_List(pl_id);
END IF;
pl_id := Create_Parameter_List('mylist');
Add_Parameter(pl_id, 'EMP_NAME',TEXT_PARAMETER, 'SMITH');
Add_Parameter(pl_id, 'DESTYPE', TEXT_PARAMETER, 'Screen');
Add_Parameter(pl_id, 'PARAMFORM', TEXT_PARAMETER, 'NO');
Run_Product(REPORTS, 'my_report', SYNCHRONOUS, RUNTIME, FILESYSTEM, pl_id, NULL);
END;
//

note:
- mylist : name of parameter list. (user defined)
- EMP_NAME : name of User Parameter in report. (user defined)
- DESTYPE : the name of System Parameter in report. (reserved word). Value = Screen|Printer|etc.
- PARAMFORM : (reserved word) specifies whether to display
the Runtime Parameter Form when you execute
a report. Default value = 'YES'.
- my_report : name of report file (REP file). (user defined)
- pl_id : the ID of parameter list.
 
hi,
sorry for being late.suppose u have a function named "func1(param1,param2)" and u have two text field in ur form named item1,item2.now at runtime, suppose some user entered two values in the text fields and u want to get the information in those fields and use it with the function.the code should be nothing but-
func1:)item1,:item2);
that means u can access the values of any field of the form at runtime just by adding a collon:)) infront of it from any trigger in the form.
for ur second question see the code bellow-
declare
cursor cur1
is select invoice_id from
purchase_invoice;
num number := 1;
begin
for cur_rec in cur1 loop
add_list_element('item3',num,lower(cur_rec.invoice_id),upper(cur_rec.invoice_id));
end loop;
end;
here i have declared a cursor named cur1, which will hold the values of invoice_id column from the purchase_invoice table.then i used a 'cursor for loop'
to populate the list item "item3" with the built-in "add_list_element".last, cur_rec is a pl/sql record which is not required to be declared,u can just use it in a 'cursor for loop'.place this code in a when_new_record_instance trigger for a datablock.then when u navigate to the block then u will find the list is populated with the values from the column of the database table.

hope these will solve ur problems.

thanks......
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top