Home » Developer & Programmer » Forms » Paramlist with Open_Form (Form6)
Paramlist with Open_Form [message #380653] Mon, 12 January 2009 21:25 Go to next message
mkhalil
Messages: 108
Registered: July 2006
Location: NWFP Peshawar Pakistan
Senior Member
I wish to pass some values from one form to another by using Parmeterlist. Following is the code to create parameterlist written in When_Mouse_Doubleclick of the calling Form.
declare
  pl_id paramlist;
  pl_name VARCHAR2(10);
BEGIN
  pl_name :=  'temp';
  pl_id :=  get_parameter_list(pl_name);
  IF NOT ID_NULL(pl_id) THEN
    destroy_parameter_list(pl_id);
  END IF;
  pl_id := create_parameter_list(pl_name);
	if :rooms_view.status in ('V','R') then
		add_parameter(pl_id,'p_mode',text_parameter,:system.record_status);
		add_parameter(pl_id,'guest_id',text_parameter,:rooms_view.guestid);
		add_parameter(pl_id,'roomtype_id',text_parameter,:rooms_view.roomtypeid);
		add_parameter(pl_id,'room_no',text_parameter,:rooms_view.roomno);
		add_parameter(pl_id,'status',text_parameter,:rooms_view.status);
  	open_form('c:\hms\hotel\recdesk\checkin2.fmx', ACTIVATE, NO_SESSION, pl_id);
  end if;
END;

and in the called I have written the following code on the event When_New_Form_Instance.
declare
	where_string varchar2(100);
begin
	if :parameter.p_mode = 'QUERY' and :parameter.status = 'R' then
		where_string := 'where guestid ='||''||:parameter.guest_id||''||'and roomtypeid ='||''||
				:parameter.roomtype_id||''||'and roomno ='||''||:parameter.room_no||'';
		set_block_property('guest_chkin',default_where,where_string);
		execute_query(no_validate);
	elsif :parameter.p_mode = 'QUERY' and :parameter.status = 'O' then
		:guest_chkin.roomtypeid := :parameter.roomtype_id;
		:guest_chkin.roomno := :parameter.room_no;
		select roomtype into :guest_chkin.roomtype from roomtype
		where roomtypeid = :parameter.roomtype_id;
	end if;
end;

The calling form successfully opend the called form but when fulfill first condition i.e. :parameter.status = 'R' then form runtime gives a message 'query caused no record to be retrieved' and on second condition i.d. :parameter.status = 'O' then no value display in the above bind variable.

Would you please guide/help me that where i am wrong.
Thanks for your time to read and write.
[EDITED by DJM: removed superfluous tabs]

[Updated on: Tue, 13 January 2009 00:02] by Moderator

Report message to a moderator

Re: Paramlist with Open_Form [message #380681 is a reply to message #380653] Tue, 13 January 2009 00:06 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Put 'message;pause;' pairs in the various triggers and get them to display the 'where_string', etc. so that you can see what the form is trying to use. Make sure that it works in 'SQL*Plus'.

What are you trying to do in the query logic? Putting the form into 'enter_query' mode is always a good place to start unless you are trying to create a new record in the 'guest_chkin' block.

David
Re: Paramlist with Open_Form [message #380682 is a reply to message #380653] Tue, 13 January 2009 00:09 Go to previous messageGo to next message
Littlefoot
Messages: 20897
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Display the WHERE string (either using a MESSAGE built-in, or put it into some item created on canvas) so that you'd see what you have told Forms to do. Then write a SELECT statement in SQL*Plus using this very WHERE clause in order to see what it returns. If you aren't satisfied with the result (which is the case here), change something to make it work.

[EDIT] Huh, right; it appears that David was posting his message at the time I was typing mine.

[Updated on: Tue, 13 January 2009 00:10]

Report message to a moderator

Re: Paramlist with Open_Form [message #380761 is a reply to message #380682] Tue, 13 January 2009 04:19 Go to previous messageGo to next message
mkhalil
Messages: 108
Registered: July 2006
Location: NWFP Peshawar Pakistan
Senior Member
Thanks David and Littlefoot. The second portion of called form is now working well the error was status = 'V' not 'O' like this
elsif :parameter.p_mode = 'QUERY' and :parameter.status = 'V' then

but the first portion is not working where as per your guidance the where_string is returning correct value i.e. but query is not executing succesfully. I have also tried the following statement in SQL*Plus and the result is ok.
select * from guest
where guestid = 61
and roomtypeid = 1
and roomno = '103';

   GUESTID GUESTNAME                      GUEST IDENT IDENTITYNO        CURRCYID COUNTRY        
---------- ------------------------------ ----- ----- --------------- ---------- ---------------
        61 FSDFDSF                        1                                                     

I don't know where is the problem. Please help me because i have a very short time to handover the application to the client.
Re: Paramlist with Open_Form [message #380786 is a reply to message #380653] Tue, 13 January 2009 05:57 Go to previous messageGo to next message
cookiemonster
Messages: 12409
Registered: September 2008
Location: Rainy Manchester
Senior Member
use:
get_block_property(<block_name>, last_query);


to find out what query it actually executed.
Re: Paramlist with Open_Form [message #380853 is a reply to message #380786] Tue, 13 January 2009 10:34 Go to previous message
mkhalil
Messages: 108
Registered: July 2006
Location: NWFP Peshawar Pakistan
Senior Member
Thanks to all. I have solved my problem. My above code was correct. Actually there are two Radio Buttons in the block guest_chkin and some data had no value for that Radio Buttons therefore the query was not executing successfully.
Once again thanks to David, Littlefoot,cookiemonster and this forum.
Previous Topic: Online Application using Forms services
Next Topic: RegisterWebUtil not found.
Goto Forum:
  


Current Time: Tue Dec 06 16:29:02 CST 2016

Total time taken to generate the page: 0.11041 seconds