Home » Developer & Programmer » Forms » How do I make the control block entry populate the data block?
How do I make the control block entry populate the data block? [message #274153] Sun, 14 October 2007 14:20 Go to next message
sara110
Messages: 17
Registered: October 2007
Junior Member
Hi. New to Forms. Using 9i dev suite.
I want to have a control block on a form where a user say department _id and then run a query to populate the data block using the id
entered from the control block. The data in the
data block is query only, the user will make a selection from the
returned data to do something else
How do I make the control block entry populate the data block?
Thanks,
Re: How do I make the control block entry populate the data block? [message #274155 is a reply to message #274153] Sun, 14 October 2007 15:07 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Set 'control_block.item' as a part of the DEFAULT WHERE clause of the 'data_block' and execute a query.
Re: How do I make the control block entry populate the data block? [message #274180 is a reply to message #274155] Sun, 14 October 2007 22:43 Go to previous messageGo to next message
sara110
Messages: 17
Registered: October 2007
Junior Member
Hi,
Thank you so much.
I have tried different things and now i am confused.
Do you mean I have to have for example Set_Block_Property('DEPARTMENTS',DEFAULT_WHERE,'control.DEPARTMENT_ID');
but where should i put it?
i have created button called "query" when_button_press fires i have this coding inside this trigger
BEGIN
go_block('control');
Set_Block_Property('DEPARTMENTS',DEFAULT_WHERE,'control.DEPARTMENT_ID');
enter_query;
:DEPARTMENTS.DEPARTMENT_ID := :control.DEPARTMENT_ID;
EXECUTE_QUERY;
END;

but it cant work.what should i do?
thanks

[Updated on: Sun, 14 October 2007 22:46]

Report message to a moderator

Re: How do I make the control block entry populate the data block? [message #274209 is a reply to message #274180] Mon, 15 October 2007 01:55 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You were close; try something like this:
BEGIN 
  Set_Block_Property('DEPARTMENTS', DEFAULT_WHERE, 
                     'departments.department_id = ' || :control.DEPARTMENT_ID
                    );
  go_block('departments');
  execute_query;
END;
Shortly: you can not code the ENTER QUERY mode - once forms enters it, it expects YOU to enter the search criteria and manually execute a query. Therefore, just create the DEFAULT WHERE and execute the query!
Re: How do I make the control block entry populate the data block? [message #274481 is a reply to message #274209] Tue, 16 October 2007 03:47 Go to previous messageGo to next message
sara110
Messages: 17
Registered: October 2007
Junior Member
Hi Dear Littlefoot

Thank you so much.If I can not code the ENTER QUERY mode, what should I do in below case? If I make DO_KEY ('ENTER_QUERY') as comment, it wont retrive any data from database block.
Thank you so much in advance.

This is ma PL/SQL code when press the button Query

DECLARE
Messg_Txt varchar2(100);

BEGIN
IF :SYSTEM.MODE = 'NORMAL' THEN
Set_Butt_Property.Enabled_False('delete_button');
Set_Butt_Property.Enabled_False('save_button');
Clear_Form(No_validate);
Value_Reassign(:Dis_Curtime, :Dis_Lname,:Dis_Fname,:Dis_Sysdate);
Set_Op_Mode.Set_Query (:form_mode);
go_item('CONTROL_BLOCK.FEECD_1');
DO_KEY ('ENTER_QUERY');

else
Set_Block_Property('CF92CAFEEGL', DEFAULT_WHERE,'FEECD = '''||:CONTROL_BLOCK.FEECD_1||'');
go_block('CF92CAFEEGL');
DO_KEY('EXECUTE_QUERY');
IF :SYSTEM.MODE = 'NORMAL' THEN
Set_Op_mode.Set_Query(:form_mode);
-- icba_msg(FALSE,'190323',1);
Op_Mode.Insert_Mode := FALSE;

IF Security_Setup.Delete_Allow = 'y' THEN
Set_Butt_Property.Enabled_True('delete_button');
END IF;
END IF;
END IF;
END;
Re: How do I make the control block entry populate the data block? [message #274666 is a reply to message #274481] Tue, 16 October 2007 14:42 Go to previous message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Please, read the OraFAQ Forum Guide to learn how to properly format your messages.

As of your problem: try to make it simple and work, and later we'll make it fancy. In other words: remove ALL code that isn't necessary. Comment it all, except the part that looks exactly as the one I've written.

There are several apostrophes in your code which I don't have, so - why did you use them? What is the name of your control block? In the first post, you called it 'control', now it is 'control_block'.

You do not have to be in an ENTER QUERY mode to execute a query; imagine you've just entered a form and pressed 'EXECUTE QUERY' button - you'll get all records by default.
Previous Topic: set scrollbar dynamically
Next Topic: Problem using Win_Api_Shell package.
Goto Forum:
  


Current Time: Sat Dec 10 12:50:28 CST 2016

Total time taken to generate the page: 0.07868 seconds