The Summit menu is attached to the Orders form. The Toggle Autoquery menu item is a check
box that toggles whether a query is automatically performed when the Orders form is first invoked.
If the check box is deselected, users must manually query.
In addition to using the menu, users want to be able to toggle the autoquery preference directly
from the form. You add a button named Toggle Autoquery with the following When-ButtonPressed trigger:
DECLARE
mi_id MENUITEMS;
BEGIN
mi_id ;=FIND_ITEM (‘Preferences.AutoQuery’)
/* Determine the current checked static of the AutoCommit menu checkbox item
And toggle the checked state*/
IF GET_ITEM_PROPERTY (mi_id, CHECKED) = ‘TRUE’ THEN
SET_ITEM_PROPERTY (mi_id, CHECKED, PROPERTY_FALSE);
ELSE
SET_ITEM_PROPERTY (mi_id, CHECKED, PROPERTY_TRUE);
END IF;
END;
However, the trigger does not compile. What three changes must you make so that the trigger
compiles successfully?
A.
Change FIND_ITEM to FIND_MENU_ITEM.
B.
Change’preferences.AutoQuery’to’orders.preferences.AutoQuery’.
C.
Change’preferences.AutoQuery’to’AutoQuery’.
D.
Change’preferences.AutoQuery’to’ORDERS.PREFERENCES>AUTOQUERY’.
E.
Change’preferences.AutoQuery’to’AUTOQUERY’.
F.
Change GET_ITEM_PROPERTY to GET_MENU_ITEM_PROPERTY
G.
Change SET_ITEM_PROPERTY toSET_MENU_ITEM_PROPERTY
H.
Change PROPERTY_FALSE to’FALSE’.
I.
Change PROPERTY_TRUE to’TRUE’.
Explanation:
A: Note: FIND_MENU_ITEM built-in
Description
Searches the list of menu items and returns a menu item ID when it finds a valid menu item with
the given name. You must define an appropriately typed variable to accept the return value. Define
the variable with a type of MenuItem.
Note 2:
FIND_ITEM built-in
Description
Searches the list of items in a given block and returns an item ID when it finds a valid item with the
given name. You must define an appropriately typed variable to accept the return value. Define the
variable
with a type of Item.
Example (with FIND_MENU_ITEM, GET_MENU_ITEM_PROPERTY,
SET_MENU_ITEM_PROPERTY)
FIND_MENU_ITEM examples
/*
** Built-in: FIND_MENU_ITEM
** Example: Find the id of a menu item before setting
** multiple properties
*/
PROCEDURE Toggle_AutoCommit_Mode IS
mi_id MenuItem;
val VARCHAR2(10);
BEGIN
mi_id := Find_Menu_Item(’Preferences.AutoCommit’);
/*
** Determine the current checked state of the AutoCommit
** menu checkbox item
*/
val := Get_Menu_Item_Property(mi_id,CHECKED);
/*
** Toggle the checked state
*/
IF val = ’TRUE’ THEN
Set_Menu_Item_Property(mi_id,CHECKED,PROPERTY_FALSE);
ELSE
Set_Menu_Item_Property(mi_id,CHECKED,PROPERTY_TRUE);
END IF;
END;
for loop is not working kindly help
declare
mi_id MenuItem;
val varchar2(10);
CURSOR MENU IS
select ltrim(rtrim(module))||’.’||ltrim(rtrim(application_code)) an, user_id
from user_rights
where read = ‘N’
and write = ‘N’
and edit = ‘N’
and erase = ‘N’
and user_id = :global.curr_user;
begin
FOR a IN MENU loop
if a.user_id = :global.curr_user then
mi_id := Find_Menu_Item(a.an);
val := Get_Menu_Item_Property(mi_id,CHECKED);
IF val = ‘TRUE’ THEN
Set_Menu_Item_Property(mi_id,visible,PROPERTY_FALSE);
else
Set_Menu_Item_Property(mi_id,visible,PROPERTY_TRUE);
END IF;
next_record;
end if;
end loop;
end;