Home » Developer & Programmer » Forms » how to use many set_block_property - default_where property in one form
how to use many set_block_property - default_where property in one form [message #356290] Thu, 30 October 2008 04:01 Go to next message
clarenz_25
Messages: 3
Registered: October 2008
Junior Member
hi

i am using oracle forms and in my program i need to filter the data that is displayed on the tabular form. i used SET_BLOCK_PROPERTY(BLOCK NAME,PROPERTY,VALUE) to filter the data and i used a button to control the filtering. i also used the trigger - when-button-pressed. But after i pressed the butoon a dialog box appears on the screen asking me if i wan to save the chages.
- if i pressed the Yes button the right query appears then
another dialog box appears on the screen telling me that
transaction complete: 1 records applied and saved.
then there is an OK button. when you pressed it.
wrong query displays on the screen or all the data
is displayed
- if i pressed the No button the right query apppears.

the problem here is i want to remove the dialog box when i pressed the button and automatically display the right output or data. i would like to ask some help about my problem. here are the codes i used in this program.

begin

if :status_item1 is null then
if :month_item1 is null then
if :year_item1 is null then

SET_BLOCK_PROPERTY('FLT_ISP',default_where,'(ENTERED_BY=:GLOBAL.ID_NUMBER OR IMP_DEPT= :GLOBAL.DEPARTMENT) and (substr(SYS_DATE,8,2)= substr(SYSDATE,8,2) and substr(sys_date,4,3)=substr(sysdate,4,3))');

go_block('FLT_ISP');
execute_query;
else

SET_BLOCK_PROPERTY('FLT_ISP',default_where,'(ENTERED_BY=:GLOBAL.ID_NUMBER OR IMP_DEPT= :GLOBAL.DEPARTMENT) and SUBSTR(SYS_DATE,8,2)= NVL(:YEAR_ITEM1,SUBSTR(SYSDATE,8,2)) and (substr(sys_date,4,3)=substr(sysdate,4,3))');
go_block('FLT_ISP');
execute_query;
end if;
else
if :year_item1 is null then

SET_BLOCK_PROPERTY('FLT_ISP',default_where,'(ENTERED_BY=:GLOBAL.ID_NUMBER OR IMP_DEPT= :GLOBAL.DEPARTMENT) and (substr(SYS_DATE,8,2)= substr(SYSDATE,8,2) AND SUBSTR(SYS_DATE,4,3)= NVL(:MONTH_ITEM1,SUBSTR(SYSDATE,4,3))');
go_block('FLT_ISP');
Execute_query;
else

SET_BLOCK_PROPERTY('FLT_ISP',default_where,'ENTERED_BY=:GLOBAL.ID_NUMBER OR IMP_DEPT= :GLOBAL.DEPARTMENT and SUBSTR(SYS_DATE,8,2)= NVL(:YEAR_ITEM1,SUBSTR(SYSDATE,8,2)) AND SUBSTR(SYS_DATE,4,3)= NVL(:MONTH_ITEM1,SUBSTR(SYSDATE,4,3))');
go_block('FLT_ISP');
execute_query;

end if;
end if;

else
if :month_item1 is null then
if :year_item1 is null then

SET_BLOCK_PROPERTY('FLT_ISP',DEFAULT_WHERE,'(ENTERED_BY=:GLOBAL.ID_NUMBER OR IMP_DEPT= :GLOBAL.DEPARTMENT) and STATUS =NVL(:STATUS_ITEM1,status) and (substr(SYS_DATE,8,2)= substr(SYSDATE,8,2) and substr(sys_date,4,3)=substr(sysdate,4,3))');
go_block('FLT_ISP');
execute_query;

else

SET_BLOCK_PROPERTY('FLT_ISP',default_where,'(ENTERED_BY=:GLOBAL.ID_NUMBER OR IMP_DEPT= :GLOBAL.DEPARTMENT) and STATUS =NVL(:STATUS_ITEM1,status) and SUBSTR(SYS_DATE,8,2)= NVL(:YEAR_ITEM1,SUBSTR(SYSDATE,8,2)) and (substr(sys_date,4,3)=substr(sysdate,4,3))');
go_block('FLT_ISP');
execute_query;

end if;

else
if :year_item1 is null then

SET_BLOCK_PROPERTY('FLT_ISP',onetime_where,'(ENTERED_BY=:GLOBAL.ID_NUMBER OR IMP_DEPT= :GLOBAL.DEPARTMENT) and STATUS =NVL(:STATUS_ITEM1,status) and (substr(SYS_DATE,8,2)= substr(SYSDATE,8,2) AND SUBSTR(SYS_DATE,4,3)= NVL(:MONTH_ITEM1,SUBSTR(SYSDATE,4,3)) and substr(sys_date,4,3)=substr(sysdate,4,3))');
go_block('FLT_ISP');
execute_query;

Else

SET_BLOCK_PROPERTY('FLT_ISP',onetime_where,'(ENTERED_BY=:GLOBAL.ID_NUMBER OR IMP_DEPT= :GLOBAL.DEPARTMENT) and STATUS =NVL(:STATUS_ITEM1,status) and SUBSTR(SYS_DATE,8,2)= NVL(:YEAR_ITEM1,SUBSTR(SYSDATE,8,2)) AND SUBSTR(SYS_DATE,4,3)= NVL(:MONTH_ITEM1,SUBSTR(SYSDATE,4,3))');
go_block('FLT_ISP');
execute_query;

end if;
end if;

end if;
end;


./fa/5221/0/
  • Attachment: filtering.JPG
    (Size: 66.10KB, Downloaded 16773 times)
Re: how to use many set_block_property - default_where property in one form [message #356327 is a reply to message #356290] Thu, 30 October 2008 06:02 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Why don't you use default Forms querying mechanism? You know, if you press Enter_query and Execute_query, you'll get all records. If you press Enter_query, enter searching criteria and then Execute_query, you'll get records that satisfy the criteria.

I'd try to keep it ass simple as possible; too much coding (sometimes / often) leads to too much problems.
Re: how to use many set_block_property - default_where property in one form [message #356480 is a reply to message #356290] Thu, 30 October 2008 21:09 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Why don't you use 'nvl' against the various 'search' items in the default 'default_where'.

David
Re: how to use many set_block_property - default_where property in one form [message #357308 is a reply to message #356327] Tue, 04 November 2008 17:21 Go to previous messageGo to next message
clarenz_25
Messages: 3
Registered: October 2008
Junior Member
hi


thanks for the reply... i tried it.. but it appears it's not what expected to appear.

what am i asking is, how could i change the block property by another block property automatically (without any confirmation to the user)by using SET_BLOCK_PROPERTY('BLOCK NAME',DEFAULT_WHERE, 'QUERY')

[Updated on: Tue, 04 November 2008 17:26]

Report message to a moderator

Re: how to use many set_block_property - default_where property in one form [message #357555 is a reply to message #357308] Wed, 05 November 2008 18:49 Go to previous message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
The message "Do you want to save the changes you have made?" means that you have changed the text in an item which is mapped to a database column.

Either DON'T map the item to a database column or make sure that you are in 'enter_query' mode before entering the search data.

David
Previous Topic: Forms crashing
Next Topic: Navigation
Goto Forum:
  


Current Time: Thu Dec 08 18:18:57 CST 2016

Total time taken to generate the page: 0.09038 seconds