geeta_m9
asked on
How can I allow for query mode?
I have a form which has three radio buttons, 'A', 'B' and 'F' which have a WHEN-RADIO-CHANGED trigger attached to them. When the user clicks on the 'F' radio button, I want it to take certain actions if the user is entering a new script into the form.The content of the trigger is listed below. However, the problem arises when the user is in query mode and clicks on the radio button, for example, if the user wants to do a search on scripts of type 'A', 'B' or 'F'. When this happens, the following error pops up: "FRM-41009: Function key not allowed. Press Ctrl+F1 for list of valid keys." What I would like is for the code in the trigger to be bypassed if the user is in query mode by inserting an IF statement, e.g., IF "user NOT in query-mode THEN execute the code in the trigger." How do I check whether the user is in query mode?
Content of Trigger:
BEGIN
IF :a.a_type = 'F' THEN
GO_BLOCK('c_a');
:a.a_columns := Null;
Set_Status('P');
IF :GLOBAL.database_instance <> 'MAIN' THEN
set_item_property('a.a_rev iewed_ind' ,enabled,p roperty_tr ue);
set_item_property('a.a_rev iewed_ind' ,update_al lowed,prop erty_true) ;
GO_BLOCK('a');
END IF;
ELSE
Set_Status('A');
set_item_property('c_a.exe cute_scrip t_btn', ENABLED, PROPERTY_TRUE);
IF :GLOBAL.database_instance <> 'MAIN' THEN
set_item_property('a.a_rev iewed_ind' ,enabled,p roperty_fa lse);
:a.a_reviewed_ind := 'N';
:a.a_reviewed_user := Null;
GO_BLOCK('a');
END IF;
END IF;
END;
Content of Trigger:
BEGIN
IF :a.a_type = 'F' THEN
GO_BLOCK('c_a');
:a.a_columns := Null;
Set_Status('P');
IF :GLOBAL.database_instance <> 'MAIN' THEN
set_item_property('a.a_rev
set_item_property('a.a_rev
GO_BLOCK('a');
END IF;
ELSE
Set_Status('A');
set_item_property('c_a.exe
IF :GLOBAL.database_instance <> 'MAIN' THEN
set_item_property('a.a_rev
:a.a_reviewed_ind := 'N';
:a.a_reviewed_user := Null;
GO_BLOCK('a');
END IF;
END IF;
END;
I don't think there is a direct way of doing it.
However you could set a global variable or pass a parameter to your form while in query mode and use that variable to base your if condition
However you could set a global variable or pass a parameter to your form while in query mode and use that variable to base your if condition
ASKER
Jrb1, where would I put that code? Would I put it in the WHEN_RADIO_CHANGED trigger?
ASKER
Sathyagiri, so in other words, I would have to assign the global variable the value when the user presses the F7 key or is there any other way to do it?
You'd put that on the ON-ERROR trigger on your form.
?? you could read out a blockproperty which says that the block is currently in query-mode
well, no forms on hand, but i guess the property sounds like status
meikl ;-)
well, no forms on hand, but i guess the property sounds like status
meikl ;-)
You also may be able to catch the error in the trigger code itself.
BEGIN
IF :a.a_type = 'F' THEN
GO_BLOCK('c_a');
:a.a_columns := Null;
Set_Status('P');
IF :GLOBAL.database_instance <> 'MAIN' THEN
set_item_property('a.a_rev iewed_ind' ,enabled,p roperty_tr ue);
set_item_property('a.a_rev iewed_ind' ,update_al lowed,prop erty_true) ;
GO_BLOCK('a');
END IF;
ELSE
Set_Status('A');
set_item_property('c_a.exe cute_scrip t_btn', ENABLED, PROPERTY_TRUE);
IF :GLOBAL.database_instance <> 'MAIN' THEN
set_item_property('a.a_rev iewed_ind' ,enabled,p roperty_fa lse);
:a.a_reviewed_ind := 'N';
:a.a_reviewed_user := Null;
GO_BLOCK('a');
END IF;
END IF;
EXCEPTION
WHEN ERROR_CODE=41009 THEN
NULL
ELSE
RAISE Form_Trigger_Failure;
END;
BEGIN
IF :a.a_type = 'F' THEN
GO_BLOCK('c_a');
:a.a_columns := Null;
Set_Status('P');
IF :GLOBAL.database_instance <> 'MAIN' THEN
set_item_property('a.a_rev
set_item_property('a.a_rev
GO_BLOCK('a');
END IF;
ELSE
Set_Status('A');
set_item_property('c_a.exe
IF :GLOBAL.database_instance <> 'MAIN' THEN
set_item_property('a.a_rev
:a.a_reviewed_ind := 'N';
:a.a_reviewed_user := Null;
GO_BLOCK('a');
END IF;
END IF;
EXCEPTION
WHEN ERROR_CODE=41009 THEN
NULL
ELSE
RAISE Form_Trigger_Failure;
END;
a bit recherche on the net
BEGIN
if get_block_property('c_a',S TATUS) != 'QUERY' then -- inserted
IF :a.a_type = 'F' THEN
GO_BLOCK('c_a');
:a.a_columns := Null;
Set_Status('P');
IF :GLOBAL.database_instance <> 'MAIN' THEN
set_item_property('a.a_rev iewed_ind' ,enabled,p roperty_tr ue);
set_item_property('a.a_rev iewed_ind' ,update_al lowed,prop erty_true) ;
GO_BLOCK('a');
END IF;
ELSE
Set_Status('A');
set_item_property('c_a.exe cute_scrip t_btn', ENABLED, PROPERTY_TRUE);
IF :GLOBAL.database_instance <> 'MAIN' THEN
set_item_property('a.a_rev iewed_ind' ,enabled,p roperty_fa lse);
:a.a_reviewed_ind := 'N';
:a.a_reviewed_user := Null;
GO_BLOCK('a');
END IF;
END IF;
end if; --inserted
END;
not tested
meikl ;-)
BEGIN
if get_block_property('c_a',S
IF :a.a_type = 'F' THEN
GO_BLOCK('c_a');
:a.a_columns := Null;
Set_Status('P');
IF :GLOBAL.database_instance <> 'MAIN' THEN
set_item_property('a.a_rev
set_item_property('a.a_rev
GO_BLOCK('a');
END IF;
ELSE
Set_Status('A');
set_item_property('c_a.exe
IF :GLOBAL.database_instance <> 'MAIN' THEN
set_item_property('a.a_rev
:a.a_reviewed_ind := 'N';
:a.a_reviewed_user := Null;
GO_BLOCK('a');
END IF;
END IF;
end if; --inserted
END;
not tested
meikl ;-)
You will put it in the ENTER-QUERY_MODE trigger I guess. Not sure.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I'll try testing the above code and get back to you.
ASKER
Jrb1, your suggestion works! Thank you! Also thanks for your help, kretzschmar and sathyagiri
DECLARE
ERR_VAL NUMBER(5) := ERROR_CODE;
MSG VARCHAR2(150)
:= SUBSTR(' '||ERROR_TYPE||'-'||TO_CHA
||ERROR_TEXT,1,150);
BEGIN
IF ERR_VAL=41009 THEN
null;
ELSE
MESSAGE(MSG);
RAISE FORM_TRIGGER_FAILURE;
END IF;
END;