Home » Developer & Programmer » Forms » Deleting record in the called form (Forms [32 Bit] Version 6.0.8.23.2 (Production))
Deleting record in the called form [message #383901] Sat, 31 January 2009 01:07 Go to next message
jamil alshaibani
Messages: 5
Registered: January 2007
Location: saudia rabia
Junior Member
Dear Friends
I am calling the form an enter_query mode, and execute_query
When I try to delete the record in the called form,it is not deleting the record


My script that I am using for deleting the record as the following:


DECLARE
al_id Alert;
al_button NUMBER;
cur_blk VARCHAR2(40) ;
LOC_BLOCK varchar2(30);
bk_id block;
Blk_Nam varchar2(30);
Begin

/*
** Get the block id since we'll be doing multiple
** Get_Block_Property operations for the same block
*/


cur_blk := :SYSTEM.Cursor_Block;
bk_id := Find_Block(cur_blk );



Blk_Nam := Get_Block_Property(bk_id,NextBlock);
If Blk_Nam is not null then
Blk_Nam := Get_Block_Property(blk_Nam,PreviousBlock);
Else
Blk_Nam := Get_Block_Property(bk_id,PreviousBlock);
If Blk_Nam is not null then
Blk_Nam := Get_Block_Property(Blk_Nam,NextBlock);
Else --only one block in Form
Blk_Nam := Get_Form_Property(:System.Current_Form ,First_Block);
End if;
End if;


al_id := Find_Alert('ALERT_DELETE');


IF Id_Null(al_id) THEN
Message('User_Warning alert does not exist');
RAISE Form_Trigger_Failure;
ELSE


/*
** Show the warning alert
*/
al_button := Show_Alert(al_id);
/*
** If user pressed OK (button 1) then bring up another
** alert to confirm -- button mappings are specified
** in the alert design
*/


IF al_button = ALERT_BUTTON1 THEN


DELETE_RECORD;
COMMIT_FORM;
IF Blk_Nam ='BLOCK_REQUEST_TYPE' THEN
MESSAGE('The Item Have Been Deleted !!!');
ELSIF Blk_Nam ='BLOCK_REQUEST_DETAILS' THEN
MESSAGE('The Item Have Been Deleted !!!');
ELSIF Blk_Nam ='BLOCK_REQUEST_HEADER' THEN
MESSAGE('The Document Have Been Deleted !!!');
END IF;
END IF;


END IF;
END;

Actually it is dispelling this message
MESSAGE ('The Item Have Been Deleted!!!');
But it is not clearing the record from the block and also the record still exist in the block and in the data base

Waiting for your valuable answer.

Best regards

Jamil alshaibani
Re: Deleting record in the called form [message #383902 is a reply to message #383901] Sat, 31 January 2009 01:26 Go to previous messageGo to next message
Littlefoot
Messages: 20893
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
If I were you, I'd get rid of all these alerts, GET_BLOCK_PROPERTIES etc. and first make it work, then make it fancy.

It means that this procedure should begin with a simple DELETE_RECORD; COMMIT; combination. Once you are sure it does the job, upgrade it to a more sophisticated level, step by step, testing each and every move you make; do not go any further until you fix errors which may appear.

Besides, what's wrong with default Forms' "delete record" toolbar button? If someone presses it, why do you want to tell him/her "Yes, the record has been deleted!!!" (as if he/she already doesn't know that)? You can't delete master when details exist - Forms will tell you so. In any other case, it will be successful. "Save" button is there to do its job as well - commit changes (i.e. deletes) you have made.

But OK, if you enjoy reinventing a wheel, go for it!
Re: Deleting record in the called form [message #383912 is a reply to message #383902] Sat, 31 January 2009 03:50 Go to previous messageGo to next message
jamil alshaibani
Messages: 5
Registered: January 2007
Location: saudia rabia
Junior Member
Dear Friend

Than you very much for your replay, I have used the above script
After I failed with the default Forms' "delete record”, because it was not giving me any message it is not deleting the record, those why I have used the above script,
And the message that I have giving it is for me not for the user just to now what is
The delete statement is doing, as well as the commit statement just to now why it
Is not deleting.
Waiting for your valuable answer
Best regards
Jamil Alshaibani

Re: Deleting record in the called form [message #383918 is a reply to message #383912] Sat, 31 January 2009 04:58 Go to previous message
Littlefoot
Messages: 20893
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I see; so these "messages" are here for debugging purpose?

If you explicitly DELETE_RECORD and COMMIT, the record must be deleted. If it is not, there must be a reason for it (such as violated foreign key constraint). However, Oracle will warn you with a message if it can not do it. If there's no message, something suppresses it. Do you, by any chance, use something like
EXCEPTION
  WHEN OTHERS THEN NULL;
or similar exception handler which hides what's going on? If so, remove it.

Also, do you have an ON-ERROR or ON-MESSAGE trigger? If so, what does it do?

Is there a database trigger which prevents you from deleting a record?

There might be something else, but ... nothing comes on my mind at the moment.
Previous Topic: HOW TO CONNECT TO MODEM IN FORMS????
Next Topic: Form Calendar Issue
Goto Forum:
  


Current Time: Mon Dec 05 04:40:59 CST 2016

Total time taken to generate the page: 0.08590 seconds