Home » Developer & Programmer » Forms » How to pass values from one form to another form?
How to pass values from one form to another form? [message #204703] Tue, 21 November 2006 16:45 Go to next message
smulukutla
Messages: 45
Registered: May 2006
Member
We have a form which has two List items, one has month and second list has Branches. When we press the button in this form, it should call another form and it has same two list items and the data from form one should automatically pop up in the second form list items.
Please let me know how to achieve this.
I tried by passing parameter from calling form(form 1) to called from(form 2). Still, the data is not automatically populating in second form.

Thanks.
Re: How to pass values from one form to another form? [message #204710 is a reply to message #204703] Tue, 21 November 2006 17:49 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Have you defined the items in the 'parameter' area of the called form? Can you 'see' them in these items? (Hint: In the When-New-Form-Instance trigger of the called form put a couple of message commands that display the contents of the ':parameter' variables. Remember to put a 'pause' command after each message command so that you can see each line as it is displayed.)

David
Re: How to pass values from one form to another form? [message #204711 is a reply to message #204703] Tue, 21 November 2006 18:04 Go to previous messageGo to next message
smulukutla
Messages: 45
Registered: May 2006
Member
In the calling from for the List Item in the when_button_pressed trigger, I wrote the query:

DECLARE
pl_id PARAMLIST;
pl_name VARCHAR2(10) := 'My_list';
BEGIN
pl_id := GET_PARAMETER_LIST(pl_name);

IF ID_NULL(pl_id) THEN
message('Created Parameterlist '||pl_name);
pl_id := CREATE_PARAMETER_LIST(:MONTH);
ELSE
DESTROY_PARAMETER_LIST(pl_name); --'GPMBRANCH.MONTH');
pl_id := CREATE_PARAMETER_LIST(:MONTH);
END IF;

message('Mesage'||:MONTH);

call_form('/export/home/mulukut/md.fmx',no_hide,do_replace,no_query_only,pl_id);
end;

In the called form, I have defined a parameter pl_id and In the when_new_form_instance I wrote the query:
:GPMBRANCH.MONTH := PARAMETER.pl_id;

Please let me know, what else I need to do?
Please help me if you have any query.

Thanks,
Sailaja.

Re: How to pass values from one form to another form? [message #204716 is a reply to message #204711] Tue, 21 November 2006 18:43 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Please read the reference manual and its examples. The 'pl_id' is used only by the calling form. In the called form you need to have in the 'parameter' block an item with the name that you used in the calling forms 'Add_parameter' commands.

Search this forum for 'add_parameter'.

David
Re: How to pass values from one form to another form? [message #204958 is a reply to message #204703] Wed, 22 November 2006 22:16 Go to previous messageGo to next message
smulukutla
Messages: 45
Registered: May 2006
Member
Hi David,
It worked, But in the called form, If I have a TextItem, the value from the calling form will get populated.
If the called form has PopList, the value from the calling from is not populated.
Please suggested me what I need to do.

Thank you somuch.
Re: How to pass values from one form to another form? [message #204974 is a reply to message #204958] Wed, 22 November 2006 23:47 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Only one value is passed in each parameter. Depending on which version of Forms you are using, parameters are either only character or can be only character, number, or date.

What are you trying to do with this Poplist? I think you need to 'use' the passed parameter value and build it into a record_group in your called form and then associate it with the LOV on a displayed item. Typically, parameter fields are NOT displayed on the screen. If you want to work with a passed parameter then assign it to an item in a 'control' block and work with this item.

David
Re: How to pass values from one form to another form? [message #205174 is a reply to message #204703] Thu, 23 November 2006 13:57 Go to previous messageGo to next message
smulukutla
Messages: 45
Registered: May 2006
Member
In the Calling form I have a poplist(MONTHLIST) and it has list of values from January to December. I have button in ths calling form, If I select January from the list and press the button,
it will take to the called form. In the called form, again I have the same poplist which has the same month list, but it should show the January in the list.

How to acheive this?
Please tell me if you have any code?

Once again thank you so much.
Re: How to pass values from one form to another form? [message #205175 is a reply to message #204703] Thu, 23 November 2006 13:58 Go to previous messageGo to next message
smulukutla
Messages: 45
Registered: May 2006
Member
We are using 10g version.
Re: How to pass values from one form to another form? [message #205196 is a reply to message #205175] Thu, 23 November 2006 19:06 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Aahh!! Some detail. Have a look at http://www.orafaq.com/forum/m/192558/67467/?srch=initial+value#msg_192558 and see if assigning the value to the Poplist item causes that value to be highlighted when the poplist is activated.

I suggest searching this forum for 'initial value' to see the similar questiosn that have been raised and why you can't populate the 'initial value'.

David
Re: How to pass values from one form to another form? [message #205448 is a reply to message #204703] Fri, 24 November 2006 23:12 Go to previous messageGo to next message
smulukutla
Messages: 45
Registered: May 2006
Member
Hi David,
Let me explain you in detail with my problem:
I have a calling form and it has a poplist for month.
And also I have a button in the calling form.
When I press the button, it will call another form and it has also the poplist for month.
When I select July from calling form and press the button,
it will take to called form and has to display July in the poplist.
So far, with my coding, it is not displaying in the poplist list directly. The July is displayed in the Dropdown list.

How to achieve this? Also, I tried setting up the initial value, no use.

My code in the calling form W_N_I_I trigger is:
DECLARE
group_id RecordGroup;
list_id Item := Find_Item('GPMBRANCH.MONTHLIST');
status NUMBER;
rg_name varchar2(40) := 'recgroup';

BEGIN
	
clear_list(list_id);
group_id := Find_Group(rg_name);

IF NOT id_null(group_id) then
    Delete_Group(group_id);
End if;

group_id := Create_Group_From_Query(rg_name, 'SELECT MONTH, MONTH FROM GPMBRANCH');
status := Populate_Group(rg_name);
Populate_List(list_id, group_id);

END;

And also, in the Calling form, W_B_P trigger:

DECLARE
pl_id PARAMLIST;
pl_name VARCHAR2(10) := :GPMBRANCH.MONTHLIST; 
BEGIN
pl_id := GET_PARAMETER_LIST(pl_name);
IF NOT ID_NULL(pl_id) THEN
  DESTROY_PARAMETER_LIST(pl_name); --'GPMBRANCH.MONTH');
END IF;

pl_id := CREATE_PARAMETER_LIST(pl_name);
ADD_PARAMETER(pl_id, 'xx', TEXT_PARAMETER, :GPMBRANCH.MONTHLIST); --:MONTH, TEXT_PARAMETER, :GPMBRANCH.MONTH);

call_form('/export/home/mulukut/m2.fmx',no_hide,do_replace,no_query_only,pl_id);
message('Created Parameter'||pl_name);
end; 

In the called form W_N_I_I I wrote:
DECLARE
group_id RecordGroup;
list_id Item := Find_Item('GPMBRANCH.MONTHLIST1');
status NUMBER;
rg_name varchar2(40) := :PARAMETER.xx;

BEGIN
clear_list(list_id);
group_id := Find_Group(rg_name);

IF NOT id_null(group_id) then
    Delete_Group(group_id);
End if;
group_id := Create_Group_From_Query(rg_name, 'SELECT distinct :PARAMETER.xx, :PARAMETER.xx FROM dual' );
status := Populate_Group(rg_name);
Populate_List(list_id, group_id);
message('status'||status);
END;  

Thanks,
Sailaja,

[Updated on: Sun, 26 November 2006 21:54] by Moderator

Report message to a moderator

Re: How to pass values from one form to another form? [message #205627 is a reply to message #205448] Sun, 26 November 2006 22:06 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
First, I don't like 'static' dynamic record_groups. I believe that non-dynamic record_groups should be used for this type of activity whenerver possible. It is easier to build and easier to maintain.

In your called form's When-New-Form-Instance have you considered just using ":GPMBRANCH.MONTHLIST1 := :PARAMETER.XX"

David

Re: How to pass values from one form to another form? [message #205801 is a reply to message #204703] Mon, 27 November 2006 11:46 Go to previous messageGo to next message
smulukutla
Messages: 45
Registered: May 2006
Member
Yes, I tried, but it's giving me FRM-40212 invalid value for the field MONTHLIST1.

Actally, The monthlist was populating in the called form, but it was populating as a drop down list.

Thanks for your reply.
Re: How to pass values from one form to another form? [message #205825 is a reply to message #205801] Mon, 27 November 2006 16:17 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
What data types do you have for these two fields?

David
Re: How to pass values from one form to another form? [message #205826 is a reply to message #204703] Mon, 27 November 2006 16:21 Go to previous messageGo to next message
smulukutla
Messages: 45
Registered: May 2006
Member
varchar2

Thanks.
Re: How to pass values from one form to another form? [message #205827 is a reply to message #205826] Mon, 27 November 2006 16:30 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
And how long are they?

David
Re: How to pass values from one form to another form? [message #205829 is a reply to message #204703] Mon, 27 November 2006 16:56 Go to previous messageGo to next message
smulukutla
Messages: 45
Registered: May 2006
Member
50
Re: How to pass values from one form to another form? [message #205831 is a reply to message #205829] Mon, 27 November 2006 17:22 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Please post the exact text of the error message or use Alt-PrintScreen to get a partial screenshot of the error.

David
Re: How to pass values from one form to another form? [message #205833 is a reply to message #204703] Mon, 27 November 2006 18:01 Go to previous messageGo to next message
smulukutla
Messages: 45
Registered: May 2006
Member
Here is the screen shot of the calling(1st form) and called(2nd form) forms.
Re: How to pass values from one form to another form? [message #205840 is a reply to message #205833] Mon, 27 November 2006 20:28 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Okay, that didn't work.

Take the screenshot and save it on your PC. Use the 'Browse' button to point to it and then use 'Upload File'.

David
Re: How to pass values from one form to another form? [message #205860 is a reply to message #204703] Mon, 27 November 2006 23:18 Go to previous messageGo to next message
smulukutla
Messages: 45
Registered: May 2006
Member
No Message Body
Re: How to pass values from one form to another form? [message #205861 is a reply to message #204703] Mon, 27 November 2006 23:21 Go to previous messageGo to next message
smulukutla
Messages: 45
Registered: May 2006
Member
here's the file.
Re: How to pass values from one form to another form? [message #205862 is a reply to message #204703] Mon, 27 November 2006 23:22 Go to previous messageGo to next message
smulukutla
Messages: 45
Registered: May 2006
Member
No Message Body
Re: How to pass values from one form to another form? [message #205874 is a reply to message #205862] Tue, 28 November 2006 00:23 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Keep trying and I will clean up the 'empties' later.

David

PS Practice in the 'test' forum.

[Updated on: Tue, 28 November 2006 00:23]

Report message to a moderator

Previous Topic: scanner OCX
Next Topic: PDF File ganeration clicking on a button
Goto Forum:
  


Current Time: Fri Sep 20 14:31:30 CDT 2024