Home » Developer & Programmer » Forms » Onetime where clause
Onetime where clause [message #471204] Thu, 12 August 2010 16:37 Go to next message
coolguy01
Messages: 64
Registered: August 2006
Member
Hi,
I am trying to filter the number of records shown when i move to form screen by building a dynamic where clause in the when-new-block instance trigger. this is the piece of code

IF ( v_where IS NOT NULL ) THEN

Set_Block_Property('BLOCK_NAME',ONETIME_WHERE,v_where);
go_block('BLOCK_NAME');
Execute_Query(all_records);
END if.

This does not retrieve any records on the screen. But if i comment the set property block and fire it like this
IF ( v_where IS NOT NULL ) THEN

go_block('BLOCK_NAME');
Execute_Query(all_records);
END if

It retrieves all the records for me. I printed out the where clause and checked it. Its passing the correct value and building the right where clause. But for some reason its not retrieving any data when i am trying to filter.
Re: Onetime where clause [message #471230 is a reply to message #471204] Fri, 13 August 2010 00:09 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Does it mean that, if you take contents of the "v_where" and use it in SQL*Plus, you get the result? Could you post both v_where and SQL*Plus session?
Re: Onetime where clause [message #471274 is a reply to message #471230] Fri, 13 August 2010 02:45 Go to previous messageGo to next message
coolguy01
Messages: 64
Registered: August 2006
Member
Yup am doin the same in my code too. I even printed out to check the where clause and it creates the right where clause. If i take the v_where clause and run in SQL*plus it fetched me the records based on where clause. But once I fire the onetime_where it does not retrieve any records even though there are records that match in DB. If i remove the onetime_where and do just execute_all it brings all the records. Also I am trying to use this in the when new form instance trigger because I want my form populated with field which are filtered based on this where clause when i enter the screen.
Re: Onetime where clause [message #471299 is a reply to message #471274] Fri, 13 August 2010 04:09 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
1) Does it make any difference if you use default where?
2) Are you sure you get back all the rows without it? Could it possibly not be getting the ones you are trying to select with the where clause?
Re: Onetime where clause [message #471343 is a reply to message #471299] Fri, 13 August 2010 08:27 Go to previous message
hanis
Messages: 5
Registered: August 2010
Junior Member
I have very similar logic in my when new instance form trigger where I filter the records except that I am using the default where vs the onetime where, and I get the correct desired results.

if :global.employee_id is not null then
v_emp_where := 'employee_id = ' || :global.employee_id;
set_block_property('ia_employee', default_where, v_emp_where);
go_block('ia_employee');
execute_query;
else
......
......
end if;
Previous Topic: Post-Block Trigger - Trying to capture previous item
Next Topic: R12 Form error
Goto Forum:
  


Current Time: Thu Sep 19 11:28:08 CDT 2024