Home » Developer & Programmer » Forms » List of value to add_parameter (oracle forms and reports 10g)
List of value to add_parameter [message #620419] Fri, 01 August 2014 03:17 Go to next message
randriana
Messages: 18
Registered: September 2010
Junior Member
Hi every body,
This is the code, my form is 10g
cursor v_dr is select code1 from T1;
for n in v_dr loop
   :dr:=n.code1;
   Add_Parameter(pl_id,'p_dr',TEXT_PARAMETER,:dr);
 
   repid := FIND_REPORT_OBJECT('rep');
   v_rep := RUN_REPORT_OBJECT(repid,pl_id);
   rep_status := REPORT_OBJECT_STATUS(v_rep); 
 
   IF rep_status = 'FINISHED' THEN
      MESSAGE('Report Completed');
      COPY_REPORT_OBJECT_OUTPUT(v_rep,'D:\LIST\pdf\'||:dr||'.pdf');
      HOST('netscape D:\LIST\pdf\'||:dr||'.pdf');
   ELSE
      MESSAGE ('Error when running report.');
   END IF;
loop

:dr is a list of value (eg:3,5,6,4,...so on) from a table T1 and depended of its value the name of the pdf file generating. When the loop go on, and :dr passing on the first value the code is OK, pdf generated as 3.pdf. But when :dr passing to second value the error frm:47013 occured as like " cannot add to the parameter and the DR name already exists on the TEMP parameter".
And is someone has any solution for me for this my friend?
Thanks a lot
Randriana

[Updated on: Fri, 01 August 2014 03:18]

Report message to a moderator

Re: List of value to add_parameter [message #620428 is a reply to message #620419] Fri, 01 August 2014 04:22 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I'm not sure, but - it seems that you'd have to destroy parameter list (if it already exists) and create a new one. There are examples in Forms Online Help system, so - have a look. Here's one of these (found on the internet & modified a little bit), just for illustration:
  pl_id ParamList; 
BEGIN 

--> start "this code would be part of your loop"
  -- Check to see if the 'tmpdata' parameter list exists. 
  pl_id := Get_Parameter_List('tmpdata'); 

  /* If it does, then delete it before we create it again in 
     case it contains parameters that are not useful for our 
     purposes here. 
  */ 
  IF NOT Id_Null(pl_id) THEN 
     Destroy_Parameter_List( pl_id ); 
  END IF; 
 
  -- Create the 'tmpdata' parameter list afresh. 

  pl_id := Create_Parameter_List('tmpdata'); 

--> end "this code would be part of your loop"

  /* Add a data parameter to this parameter list that will 
     establish the relationship between the named query 
    'EMP_QUERY' in the report, and the record group named 
    'EMP_RECS' in the form. 
  */ 

  Add_Parameter(pl_id,'EMP_QUERY',DATA_PARAMETER,'EMP_RECS'); 
Re: List of value to add_parameter [message #620433 is a reply to message #620428] Fri, 01 August 2014 06:43 Go to previous messageGo to next message
randriana
Messages: 18
Registered: September 2010
Junior Member
thanks Littlefoot but i do not really understand what will i do as you suggest . How to make relation between the emp_recs record group and emp_query in the report. What is the datatype of the emp_query and how to pass emp_recs record group to emp_query on the report. I haven't done any report like this and i haven't used DATA_PARAMETER also. Please help me!!!
The full code is:
declare
    repid reportobject;
    v_Rep VARCHAR2(100);
   rep_status VARCHAR2(20);
   pl_id paramlist;
   cursor v_dr is select code1 dr  from T1
   ;
BEGIN
 
  pl_id:=get_parameter_list('Temp');
   if not id_null(pl_id) then
    destroy_parameter_list('temp');
   end if; 
   pl_id := Create_Parameter_List('Temp'); 
   Add_Parameter(pl_id,'op',TEXT_PARAMETER,:op);  ---:op is a  form item
   Add_Parameter(pl_id,'par',TEXT_PARAMETER,:par); ---:par is a item
   /*they are two block the first is contained the two text_parameter :op and :par  */
   next_block;
   /* the second block contain :dr that a populate list as a say*/
 for n in v_dr loop
   :dr:=n.dr;
   Add_Parameter(pl_id,'p_dr',TEXT_PARAMETER,:p_dr);
   :recept_nom:=n.lib;
   synchronize;
   repid := FIND_REPORT_OBJECT('bafko_ariary_a4_feno_omd');
   v_rep := RUN_REPORT_OBJECT(repid,pl_id);
   rep_status := REPORT_OBJECT_STATUS(v_rep);
 
   IF rep_status = 'FINISHED' THEN
      MESSAGE('Report Completed');
      COPY_REPORT_OBJECT_OUTPUT(v_rep,'D:\LIST\pdf\'||:dr||'.pdf');
      HOST('netscape D:\LIST\pdf\'||:dr||'.pdf');
   ELSE
      MESSAGE ('Error when running report.');
   END IF;
   :p_dr:=null;
  end loop;

end;

Thanks
Randriana

[Updated on: Fri, 01 August 2014 06:45]

Report message to a moderator

Re: List of value to add_parameter [message #620437 is a reply to message #620433] Fri, 01 August 2014 07:43 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You got me wrong; you'd destroy and create parameter list WITHIN the loop - not in front of it, as it won't change anything. Your code fails when it comes to the second loop execution - that's why I thought that recreated parameter list *might* help.
Re: List of value to add_parameter [message #620532 is a reply to message #620437] Mon, 04 August 2014 01:49 Go to previous message
randriana
Messages: 18
Registered: September 2010
Junior Member
Thanks a lot my friend Littlefoot, the program go on very well, it's ok

[Updated on: Mon, 04 August 2014 01:50]

Report message to a moderator

Previous Topic: Positioning an image on XLS file using ole2
Next Topic: Oracle Forms (6i) Calendar
Goto Forum:
  


Current Time: Fri Mar 29 05:06:48 CDT 2024