Home » Developer & Programmer » Forms » 10g - enter_query/execute_query-problem (Form Builder 10g)
10g - enter_query/execute_query-problem [message #519932] Wed, 17 August 2011 10:30 Go to next message
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 Go to previous messageGo to next message
Littlefoot
Messages: 21813
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 #519940 is a reply to message #519936] Wed, 17 August 2011 11:07 Go to previous messageGo to next message
cookiemonster
Messages: 13926
Registered: September 2008
Location: Rainy Manchester
Senior Member
Also enter-query is block specific. It goes into enter-query mode on the block the cursor is currently in. You can't then change block until you execute a query or cancel enter-query mode.
Re: 10g - enter_query/execute_query-problem [message #520101 is a reply to message #519940] Thu, 18 August 2011 10:34 Go to previous messageGo to next message
Acryl
Messages: 4
Registered: August 2011
Location: Belgium
Junior Member
Okay, I almost get what enter_query does and how I should avoid using it.

I changed the LOV from the detail-block ('PROJECT'), so it doesn't fill in values and goes straight to COMPANY, fills in the CCODE and executes the query there.
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 := name_in('CCODE');
message(v_get_value);

go_block('FIRMA');

:FIRMA.CCODE := v_get_value;

execute_query;

end ;


But apparently it doesn't take the CCODE. It just uses the first record of Company it can find. I'm not sure why.

Can you use name_in('CCODE') if there aren't any return values?
The problem is, if I use return values, it fills in the detail block and doesn't do the query properly.

Thanks for your times already!
Re: 10g - enter_query/execute_query-problem [message #520131 is a reply to message #520101] Thu, 18 August 2011 13:41 Go to previous messageGo to next message
cookiemonster
Messages: 13926
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 #520132 is a reply to message #520131] Thu, 18 August 2011 13:45 Go to previous messageGo to next message
Acryl
Messages: 4
Registered: August 2011
Location: Belgium
Junior Member
well. company.ccode = project.ccode.

user has to be able to search project.name via LOV and then all the info has to be filled in. So company (the master) and project (detail).
Re: 10g - enter_query/execute_query-problem [message #520153 is a reply to message #520132] Thu, 18 August 2011 16:57 Go to previous messageGo to next message
cookiemonster
Messages: 13926
Registered: September 2008
Location: Rainy Manchester
Senior Member
And the LOV's are on which items?
Re: 10g - enter_query/execute_query-problem [message #520226 is a reply to message #520153] Fri, 19 August 2011 07:15 Go to previous messageGo to next message
Acryl
Messages: 4
Registered: August 2011
Location: Belgium
Junior Member
LOV for company is on COMPANY.NAME, LOV for PROJECT is a pushbutton.
Re: 10g - enter_query/execute_query-problem [message #520234 is a reply to message #520226] Fri, 19 August 2011 08:04 Go to previous message
cookiemonster
Messages: 13926
Registered: September 2008
Location: Rainy Manchester
Senior Member
Acryl wrote on Fri, 19 August 2011 13:15
LOV 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?
Previous Topic: FRM-40733 error
Next Topic: invalid cursor in 9i (but works on 11g)
Goto Forum:
  


Current Time: Fri Jul 26 06:05:33 CDT 2024