10g - enter_query/execute_query-problem [message #519932] |
Wed, 17 August 2011 10:30 |
|
Acryl
Messages: 4 Registered: August 2011 Location: Belgium
|
Junior Member |
|
|
Hello,
I'm fairly new to Form Builder and I experience following problem, which I can't seem to figure out.
So, I want to use my form only for query-functions.
When one enters the form, he can look up records either on Companyname or on Projectname. Therefor I have provided 2 buttons who pop-up a LOV. After eitherone is selected, the query has to be executed. There is a Master-Detail relationship between Company and Project.
My plsql for the company button:
declare
v_show_lov boolean ;
begin
enter_query;
v_show_lov := show_lov('LOVFIRMA');
if not v_show_lov then
message('selecteer een firma');
raise form_trigger_failure;
end if;
execute_query;
end ;
Plsql for the project button:
declare
v_show_lov boolean;
v_get_value number;
begin
v_show_lov := show_lov('LOVPROJECT');
if not v_show_lov then
message('selecteer een project');
end if;
v_get_value := :PROJECT.CCODE;
--v_get_value := name_in('CCODE');
go_block('FIRMA');
:FIRMA.CCODE := v_get_value;
execute_query;
go_item('contract.projcode');
end ;
The first button only works when I go manually in Querymode first (by pressing F11). So I reckon my enter_query doesn't work? The property 'Fire in Enter-Query Mode' is Yes.
The second is a different story.
When I press it in non-query mode. It just fills in the LOV-values and the CCODE from company. It doesn't execute the query (probably because there is no enter_query).
When I enter query mode, the focus changes automatically to Company. And the LOV doesn't appear.
I have tried placing the enter_query on different places, just as the go_block and clear_block things, but there is always something wrong.
Hope you can help me!
|
|
|
Re: 10g - enter_query/execute_query-problem [message #519936 is a reply to message #519932] |
Wed, 17 August 2011 10:49 |
|
Littlefoot
Messages: 21818 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Maybe you don't really need master-detail here. As, obviously, both LoV items exist in a detail block, create a single block, let user enter any item combination (including your 2 LoVs) and fetch data. It would be: push ENTER QUERY, enter item values, push EXECUTE QUERY.
As of your question: don't code ENTER_QUERY (except, for example, if you want to enter query mode when the form starts up) because, as Forms gets to ENTER_QUERY, execution is stopped and it awaits for user's input. So, if you want, you could ENTER_QUERY in WHEN-NEW-FORM-INSTANCE trigger, let the user choose value from a LoV and then push the EXECUTE QUERY button (on the standard Forms' toolbar).
If you insist (i.e. don't want to use built-in querying functionalities), set detail block's item values in a PRE-QUERY detail block level trigger.
Basically, you shouldn't code much here as Forms querying mechanism works extraordinary well. Just let Forms do its job.
|
|
|
|
|
Re: 10g - enter_query/execute_query-problem [message #520131 is a reply to message #520101] |
Thu, 18 August 2011 13:41 |
cookiemonster
Messages: 13938 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Assigning values to items and expecting those values to be used in a query only works if you're in enter-query mode.
If you're in enter-query mode go_block doesn't work.
Maybe it'd help if you explained the relationship between the blocks.
|
|
|
|
|
|
Re: 10g - enter_query/execute_query-problem [message #520234 is a reply to message #520226] |
Fri, 19 August 2011 08:04 |
cookiemonster
Messages: 13938 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Acryl wrote on Fri, 19 August 2011 13:15LOV for PROJECT is a pushbutton.
And that means what exactly?
I'm begining to feel like I'm pulling teeth here.
I'm trying to get a proper description of what you've got and what you're trying to do so I can suggest a way to make it work.
Do I really need to prompt for every single detail?
|
|
|