Home » Developer & Programmer » Forms » Share Paramlist Pacakge Variables
Share Paramlist Pacakge Variables [message #194099] Wed, 20 September 2006 15:35 Go to next message
gbustosespinoza
Messages: 2
Registered: September 2006
Location: Costa Rica
Junior Member
I need to share PARAMLIST packaged variables among forms and I use the SHARE_LIBRARY_DATA option in the CALL_FORM for this purpose.
All of the varchar2 variables OR number variables share OK, but the Paramlist variables no. The error FRM-47007 "Cannot get parameter %s attributes from Parameter List : invalid list ID."
Is there a way to share Paramlist packaged variables?

I put a little sample code that represent the case. The example consist in two forms (FORM A, FORM B and a Package declared on a Librarie)
The Form A, set a value for the Parameter List, and then call the Form B, in the Form B I try to show the value of the parameter, and then the error jump the error FRM-47007.

Here is the code.

The PACKAGE code is the following in the library is the following:

/*SPEC Section:*/
PACKAGE PCK_LIST IS
P_List PARAMLIST;
FUNCTION Fun_Value Return Varchar2;
END;

/*BODY Section*/
PACKAGE BODY PCK_LIST IS
/*Function for return the parameter value*/
FUNCTION Fun_Value RETURN VARCHAR2 IS
v_Type Number;
v_Value Varchar2(30);
BEGIN
p_list := Get_Parameter_List('LIST');
get_parameter_attr(p_list,'PARAMETER',v_Type,v_Value);
RETURN v_Value;
END;
END;

The FORM A have a Push_Button with the following code:

DECLARE
P_List_Form Paramlist; --Parameter List at Form Level
v_Value Varchar2(30);
BEGIN

/*Assign the value to the Paramter in the Parameter List*/
P_List_Form := Get_Parameter_List('LIST');
IF NOT ID_Null(P_List_Form) THEN
Destroy_Parameter_List(P_List_Form);
END IF;
P_List_Form := Create_Parameter_List('LIST');
Add_Parameter(P_List_Form,'PARAMETER',TEXT_PARAMETER,'VALUE XXX');

/*Assign the P_List_Form to the Parameter List in the Package*/
PCK_LIST.P_LIST := P_List_Form;

/*Gets the value before go to the FORM B*/
v_Value := PCK_List.Fun_Value;
message('Value before call FORM B:'||v_Value,ACKNOWLEDGE);

/*Call to the Form B with SHARE_LIBRARY_DATA*/
CALL_FORM('FORM_B', NO_HIDE, DO_REPLACE, NO_QUERY_ONLY, SHARE_LIBRARY_DATA);

/*Gets the value after go to the FORM B*/
/*only to show that even after close the form, the value on the parameter is the same*/
v_Value := PCK_List.Fun_Value;
message('Value after call FORM B:'||v_Value,ACKNOWLEDGE);

END;


The FORM B have a Text Item and in the WHEN-NEW-FORM-INSTANCE Trigger have the following code:
/*Gets the value after go to the FORM B*/
/*Here jumps the error frm-47007*/
:ITEM_PARAMETER_VALUE := PCK_List.Fun_Value;

Thanks
Re: Share Paramlist Pacakge Variables [message #194855 is a reply to message #194099] Mon, 25 September 2006 14:12 Go to previous message
gbustosespinoza
Messages: 2
Registered: September 2006
Location: Costa Rica
Junior Member
I put the answer I got in another forum, I hope it could help someone:

A parameter list is not a datatype it is a forms level object and is private to that form. It cannot be passed around in the manner you are trying to. If you want to pass a parameter list to a new form you must explicitly pass it via the call_form, open_form built ins.

add the paramter list (P_List_Form ) you created in the calling form to the call_form built in you are using e.g.
CALL_FORM('FORM_B', NO_HIDE, DO_REPLACE, NO_QUERY_ONLY, SHARE_LIBRARY_DATA,P_List_Form);

Then in form B (the called form) you should be able to use the
DECLARE
v_type NUMBER;
v_Value VARCHAR2(30);

BEGIN

P_List := Get_Parameter_List('LIST');
get_parameter_attr(p_list,'PARAMETER',v_Type,v_Value);
--bla bla bla....
END;

Remember parameter lists are mono directional. They can only be passed from the calling form (form A) to the called form (form B). If you want to modify the value in form B and the pass it back to form A, I would recommend using global variables instead.

The SHARE_LIBRARY_DATA should work if you create a package in a forms library that contains variables. Below is an exam of how it should roughly look and work.

In you library you have the following package spec:
PACKAGE test IS
v_test VARCHAR2(30);
END;

On the button where you have call_form (in FORM_A) you have the following code:
begin
-- populate the library packaged variable
test.v_test := 'testing val';

call_FORM('FORM_B', NO_HIDE, DO_REPLACE, NO_QUERY_ONLY,SHARE_LIBRARY_DATA);

end;

Then in the called form (FORM_B) you have the follow where ever you require the value (in your case the when-new-form-instance trigger):
:TESTBLOCK.ITEM_PARAMETER_VALUE := test.v_test;
Previous Topic: Slow reports!
Next Topic: problem in changing HOTKEYS using fmrweb.res in Forms 10G
Goto Forum:
  


Current Time: Sat Dec 10 16:46:12 CST 2016

Total time taken to generate the page: 0.08608 seconds