问题
I'm learning Oracle Forms and Reports, This time I would like to coding within a push button some functionalities. I've added a push button named "Filter" for active the "enter_query" mode to add some search criteria using "WHEN-BUTTON-PRESSED" trigger in item level and adding code within this trigger. It's too easy to code:
BEGIN
ENTER_QUERY;
END;
But now, I have to add two new functionalities to this button:
1- First, When I write some search criteria and after push in the second button named "SEARCH" to retrieve data relationated the button "filter" have to rename to "LAST RECORD" and if I press "LAST RECORD" button the form should to retrieve only the last record retrieved of the las search. I've think about how I should to resolve this problem and I've tried to add SET_ITEM_PROPERTY to trigger but it is not working correctly.
BEGIN
ENTER_QUERY;
SET_ITEM_PROPERTY('BLOCK_NAME', LABEL, 'LAST RECORD');
LAST_RECORD;
END;
2- And finally, after press in "LAST RECORD" button, It should to rename to "CANCEL" and if I press in this button one more time it should to clear the form and start again in the first position named "FILTER" to start a new search criteria as many time as the client want to do it...
Do you have any idea? Thanks.
回答1:
you may edit this snippet :
begin
if ( :system.mode = 'ENTER-QUERY' ) then
set_item_property('b_search', label, 'search');
go_block('blk_yours');
execute_query;
else
set_item_property('b_search', label, 'last record');
go_block('blk_yours');
enter_query;
end if;
last_record;
end;
in when-button-pressed
trigger of the item b_search
来源:https://stackoverflow.com/questions/46085178/how-to-change-the-push-button-label-text-and-add-a-new-functionality-in-runtime