insert into database problem [message #466966] |
Wed, 21 July 2010 15:38 |
klmn
Messages: 6 Registered: July 2010
|
Junior Member |
|
|
I have a form and 2 blocks(master-detail) and try to add a new record when I press "insert record" button from toolbar. But there occurs a problem. If I don't write 'CLEAR_FORM' just after calling "button_proc" procedure, record is not added into database.I couldn't understand why. Please somebody help.
|
|
|
|
Re: insert into database problem [message #466968 is a reply to message #466967] |
Wed, 21 July 2010 15:58 |
klmn
Messages: 6 Registered: July 2010
|
Junior Member |
|
|
No, I didnt forget. Actually I tried this with generic toolbar which was used in many examples, I did not change anything but it cannot insert. Interesting thing is whenever I add a 'CLEAR_FORM' , it accomplishes task. It is so meaningless why it does this.
|
|
|
|
Re: insert into database problem [message #467011 is a reply to message #466978] |
Thu, 22 July 2010 00:50 |
klmn
Messages: 6 Registered: July 2010
|
Junior Member |
|
|
BUTTON_PROC PROCEDURE DOES FOLLOWINGS;
PROCEDURE button_proc IS
action varchar(80);
-- hide a button (for ENTER_-, EXECUTE_- or CANCEL_QUERY)
PROCEDURE show_off(item_name VARCHAR2) IS
BEGIN
IF NOT Id_Null(Find_Item(item_name)) THEN
Set_Item_Property(item_name, ENABLED,PROPERTY_FALSE);
END IF;
END;
-- try to show a button (for the two query-states. If there is no button to show,
-- return FALSE to the calling procedure.
FUNCTION show_on(item_name VARCHAR2) RETURN BOOLEAN IS
BEGIN
IF NOT Id_Null(Find_Item(item_name)) THEN
Set_Item_Property(item_name,DISPLAYED,PROPERTY_TRUE);
Set_Item_Property(item_name,ENABLED,PROPERTY_TRUE);
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
RETURN NULL; END;
BEGIN
action := Get_Item_Property(NAME_IN('SYSTEM.TRIGGER_ITEM'),ITEM_NAME);
IF action = 'ENTER_QUERY' THEN
-- only hide the ENTER_QUERY button, if there are EXECUTE_QUERY and (!!) CANCEL_QUERY
-- buttons. Otherwise an existing EXECUTE_QUERY button will be shown.
IF show_on('EXECUTE_QUERY') AND show_on('CANCEL_QUERY') THEN
show_off('ENTER_QUERY');
END IF;
END IF;
IF action IN ('EXIT_FORM', 'EXIT','QUIT') THEN
action := 'EXIT_FORM';
IF NAME_IN('SYSTEM.MODE')='ENTER-QUERY' THEN
Do_Key('EXIT_FORM');
END IF;
END IF;
IF action = 'CANCEL_QUERY' THEN
action := 'EXIT_FORM';
END IF;
Do_Key(action);
IF NAME_IN('SYSTEM.MODE') != 'ENTER-QUERY' THEN
IF show_on('ENTER_QUERY') THEN
show_off('EXECUTE_QUERY');
show_off('CANCEL_QUERY');
END IF;
END IF;
END;
[EDITED by LF: applied [code] tags]
[Updated on: Thu, 22 July 2010 00:51] by Moderator Report message to a moderator
|
|
|
|
Re: insert into database problem [message #467030 is a reply to message #467013] |
Thu, 22 July 2010 01:20 |
klmn
Messages: 6 Registered: July 2010
|
Junior Member |
|
|
First of all thank you for replying.
I have 'TOOLBAR' block and for example one of its items is COMMIT_FORM button. Here whenever I pressed this button, BUTTON_PROC gets its name and accomplishes commiting task.
I used CLEAR_FORM just after whenever I call BUTTON_PROC. I mean that , I created 'WHEN-BUTTON-PRESSED' trigger under 'TOOLBAR' block and in this trigger I wrote followings;
button_proc;
CLEAR_FORM;
|
|
|
|
|