Home » Developer & Programmer » Forms » Delete Option not Working (oracle 10g)
Delete Option not Working [message #503610] Mon, 18 April 2011 05:41 Go to next message
shanie
Messages: 118
Registered: January 2011
Senior Member
Hi,

It is a Students Leave Application form.
Each Student leave application history is maintained.
So One Student has multiple records.

I have Two Blocks. Main Block and Dummy Block.
Main Block is used to enter the Students data.
Dummy Block is used to display the Students data.

When I give Student ID in Main Block and press enter,
It displays previous data in Dummy block.
The Cursor is in the Second field
of the Main Block where we fill the Students Data.
Then the Data is saved and displayed in Dummy block.

When I want to Delete a Record, The Option remove record is
not working in this form.
I write code in key-Delrec trigger also
delete_record;
clear_form;
commit;

But the record is not deleted it remains in database.
When deleting a record Data must be in Main Block.
But the Main block is empty initially.
I don't know what to do to delete a record.

Fields in Main block : Student ID, Name,Noofdays,datefrom,
dateto,official.
Dummy block contains same fields and
displays the student past data.

Please help in solving this delete record issue.

Thanks and Regards,
Shanie

Re: Delete Option not Working [message #503611 is a reply to message #503610] Mon, 18 April 2011 05:48 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
Are the two blocks database blocks?
From which block are you trying to delete data?
What level is the key-delrec trigger defined at - form or block?
When you press the delete button do you get an error message?
Re: Delete Option not Working [message #503614 is a reply to message #503611] Mon, 18 April 2011 06:16 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Did you consider deleting a record without clearing the form (and then committing)? How about
delete_record;
commit;
Re: Delete Option not Working [message #503615 is a reply to message #503614] Mon, 18 April 2011 06:39 Go to previous messageGo to next message
shanie
Messages: 118
Registered: January 2011
Senior Member
Hi,

Main Block is Database Block where data is going to Database.
Dummy Block is where data is retrieved from the database
From Main Block I try to delete the record.
Because Dummy is only used to display the data.
I gave at Form level.
After removing record when I press Save button
It gives messages like
Invalid ID Select Active ID from the list.
Then After save option dialog box.
then Application closes.

I tried using Enter Query and Execute Query Option
I gave Student ID and Date From fields and
Data is fetched in Main Block.
I press Remove record Option.
"Before Clicking Save I enter different data in
Main Block and then press Save button.
I can able to delete record but
at the same time new record is also entered.
If I remove record without filling main block then
same above messages are coming and closing the form.

Please Help.

Thanks & Regards,
Shanie
Re: Delete Option not Working [message #503616 is a reply to message #503615] Mon, 18 April 2011 06:44 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
shanie wrote on Mon, 18 April 2011 12:39
It gives messages like
Invalid ID Select Active ID from the list.

That's not a form builder error message.
So there must be some code in form causing it.
Find it and tell us what trigger it's in.
Re: Delete Option not Working [message #503618 is a reply to message #503616] Mon, 18 April 2011 06:51 Go to previous messageGo to next message
shanie
Messages: 118
Registered: January 2011
Senior Member
Hi,

It is throwing the Exception
"Invalid student ID Select Active ID from List"
Exception Name : when no_data_found
Written in Post text Item of Student ID.

Regards,
Shanie
Re: Delete Option not Working [message #503619 is a reply to message #503618] Mon, 18 April 2011 06:56 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
Give the full code of the trigger
Re: Delete Option not Working [message #503621 is a reply to message #503619] Mon, 18 April 2011 07:08 Go to previous messageGo to next message
shanie
Messages: 118
Registered: January 2011
Senior Member
BEGIN

SELECT spriden_first_name || ' ' ||
spriden_mi || ' ' || spriden_last_name
INTO :GZAOFFE_FULLNAME
FROM spriden
WHERE SPRIDEN_ID = :GZAOFFE_STU_ID
and spriden_change_ind is null;

EXCEPTION
WHEN NO_DATA_FOUND THEN
Message('Invalid ID, Select Active Id from list.');
WHEN OTHERS THEN
Message(sqlcode ||':'||sqlerrm);
END;

When I give Student ID and Press Enter
Student Full name comes and
Students data in Dummy Block is displayed.
I fill data in Main Block like
No of days,Date from, Date to, Official
and Press Save Button. Data is saved form is cleared.

But Deleting a record causing me problem.

Regards,
Shanie
Re: Delete Option not Working [message #503630 is a reply to message #503621] Mon, 18 April 2011 08:48 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
You do realise that delete_record will only work if you query the record you want to delete first?
Re: Delete Option not Working [message #503631 is a reply to message #503630] Mon, 18 April 2011 08:54 Go to previous messageGo to next message
shanie
Messages: 118
Registered: January 2011
Senior Member
Yes I agree and I'm doing that only
but it didnt happening.

Exception is thrown as soon as I press Save button
after removing record which is found
through enter query in Main Block.

If I remove exception then No data found error
is coming.

Please sort this problem.

Regards,
Shanie
Re: Delete Option not Working [message #503632 is a reply to message #503631] Mon, 18 April 2011 09:04 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
Wrap the code in the post-text-item trigger in an IF statement that checks that GZAOFFE_STU_ID is not null.
Re: Delete Option not Working [message #503633 is a reply to message #503632] Mon, 18 April 2011 09:04 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
Or better yet change the post-text-item into a when-validate-item since I'm pretty sure that's what it should be.
Re: Delete Option not Working [message #503634 is a reply to message #503633] Mon, 18 April 2011 09:25 Go to previous messageGo to next message
shanie
Messages: 118
Registered: January 2011
Senior Member
Its working in When validate item trigger
But there are Mandatory fields which cannot
be left blank like Student ID, Noofdays,Datefrom
which is mentioned in Pre-Commit trigger at form level.

If I disable this then it is working fine
other wise error coming student ID cannot be left blank.

Any Alternate solution to this validation!

Thanks and Regards,
Shanie

Re: Delete Option not Working [message #503635 is a reply to message #503634] Mon, 18 April 2011 09:33 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
Validation should only ever be done in validate triggers.
So move those checks to when-validate-record.
Or just set the required property on the items instead.
I never use pre-commit for anything.
Re: Delete Option not Working [message #503720 is a reply to message #503635] Tue, 19 April 2011 02:15 Go to previous messageGo to next message
shanie
Messages: 118
Registered: January 2011
Senior Member
Hi,

I thank you very much for your kind help.

Checks still gave errors when I moved to
when-validate-record or set required property to yes.
But later I moved those checks to key-commit trigger.
Now It is working well.

Is this fine to move checks in key-commit trigger?

Thanks and Regards,
Shanie
Re: Delete Option not Working [message #503722 is a reply to message #503720] Tue, 19 April 2011 02:17 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Probably not. It might happen that your user will try to exit the form, get the "Do you want to save changes?" message, answer "Yes" and - changes will be saved, but KEY-COMMIT won't be executed.
Re: Delete Option not Working [message #503729 is a reply to message #503722] Tue, 19 April 2011 02:55 Go to previous messageGo to next message
shanie
Messages: 118
Registered: January 2011
Senior Member
How to overcome this issue?
We need check compulsory
Both When-validate-record and set required property
are causing errors
Now I found error in key commit also.

Please suggest the solution.

Regards,
Shanie
Re: Delete Option not Working [message #503739 is a reply to message #503729] Tue, 19 April 2011 05:39 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Saying that WHEN-VALIDATE-RECORD caused errors is not very descriptive. What code did you put in there? What errors did you get?
Re: Delete Option not Working [message #503740 is a reply to message #503739] Tue, 19 April 2011 05:55 Go to previous messageGo to next message
shanie
Messages: 118
Registered: January 2011
Senior Member
Code Under When-validate-record
Begin
IF :GZAOFFE_STU_ID IS NULL OR
:GZAOFFE_NOFDAY IS NULL OR
:GZAOFFE_DATE_FROM IS NULL THEN
MESSAGE('Student ID, No of days & Date from cannot be left Blank');
raise Form_trigger_failure;
End if;

end;

When I enter student ID and Pressing enter
It is giving error message
"Student ID, No of days & Date from cannot be left Blank"

Please help.

Regards,
Shanie
Re: Delete Option not Working [message #503742 is a reply to message #503740] Tue, 19 April 2011 06:11 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
So don't leave those items empty!
Re: Delete Option not Working [message #503744 is a reply to message #503742] Tue, 19 April 2011 07:04 Go to previous messageGo to next message
shanie
Messages: 118
Registered: January 2011
Senior Member
Problem is when deleting a record.
It gives me that error message.
It is not allowing me to delete.

Regards,
Shanie
Re: Delete Option not Working [message #503745 is a reply to message #503744] Tue, 19 April 2011 07:15 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I think you never answered: did you remove CLEAR_FORM from the KEY-DELREC trigger? What happened?

As you use Forms 10g: it offers running a form in debug mode. Did you try it? It makes all system (and your own) variables visible, so you'd know what is happening, which triggers are firing so - you might find what is bothering you.

If nothing helps, perhaps you could provide a simple test case (CREATE TABLE and INSERT INTO several records of sample data) and attach your form, so that we could take a look?
Re: Delete Option not Working [message #503747 is a reply to message #503745] Tue, 19 April 2011 07:29 Go to previous messageGo to next message
shanie
Messages: 118
Registered: January 2011
Senior Member
Yes I already removed clear_form from key delrec that day.

But Still that message is displaying.
compilation will be done is Unix.

I'll will send u code what written in triggers.
If you want a look.

Regards,
Shanie


Re: Delete Option not Working [message #503759 is a reply to message #503747] Tue, 19 April 2011 09:17 Go to previous messageGo to next message
shanie
Messages: 118
Registered: January 2011
Senior Member
Dear All and
Specially to Cookiemonster
Please help me!

You have understood the complete scenario.
Checks issue is not solved.
If I remove checks then I can able to delete the record.
If I apply the checks in when validate record then
Error message is coming Fields cannot be left blank.

Please help.

Regards,
Shanie
Re: Delete Option not Working [message #503777 is a reply to message #503759] Tue, 19 April 2011 12:16 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
Delete should not cause when-validate-record to fire.
Check the form_status, block_status and record_status before the delete_record.
Run the form in debug mode to check what triggers are firing.
Re: Delete Option not Working [message #503874 is a reply to message #503777] Wed, 20 April 2011 03:38 Go to previous messageGo to next message
shanie
Messages: 118
Registered: January 2011
Senior Member
It is form which is attached in server.
I compile in Unix and place fmx server.

I don't know how to run in Debug mode for this scenario.

We don't run by clicking
on "Run form" or "Run form Debug" from client machine.
Server link is there where we run in browser.

However, we can see compiling log file.

Please sort out this issue.

Regards,
Shanie


Re: Delete Option not Working [message #503875 is a reply to message #503874] Wed, 20 April 2011 03:45 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
Is there anything actually stopping you running the form in debug mode direct from form builder?
If there really is then you'll just have to put messages in every trigger to work out what's going on.
Re: Delete Option not Working [message #503902 is a reply to message #503875] Wed, 20 April 2011 04:46 Go to previous messageGo to next message
shanie
Messages: 118
Registered: January 2011
Senior Member
Actually we cannot compile or run
from form builder, If we do
It gives so many errors.

Could you explain briefly about giving messages
in every trigger.

I mean what exactly I have to do?

Re: Delete Option not Working [message #503922 is a reply to message #503902] Wed, 20 April 2011 08:26 Go to previous messageGo to next message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
shanie wrote on Wed, 20 April 2011 05:46
Actually we cannot compile or run
from form builder, If we do
It gives so many errors.


Give an example one error.
Re: Delete Option not Working [message #503925 is a reply to message #503922] Wed, 20 April 2011 08:36 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
Put a message in every trigger that displays the name of the trigger.
Also put messages in the delete button before the delete_record command to display the three statuses I mentioned above.

But before that you really should fix the issue with being unable to compile forms in form builder, you can't possibly work efficiently without it.
Re: Delete Option not Working [message #504302 is a reply to message #503925] Sat, 23 April 2011 01:47 Go to previous messageGo to next message
shanie
Messages: 118
Registered: January 2011
Senior Member
Delete record is going smoothly when
I gave when-validate-record at Block Level.
Previously I was giving at Form Level.

When Inserting a new record If I leave mandatory field empty,
then Message dialog box displays 'cannot be left empty'
It is not allowing me to do any thing nor closing the application.
When I click 'OK' It is coming again and again.

In When-validate-record Trigger for Checks after message
"raise Form_trigger_failure" is given.

If I remove this then record will be Inserted.

Please suggest any alternate handler to this issue.

Regards,
Shanie

Re: Delete Option not Working [message #504303 is a reply to message #504302] Sat, 23 April 2011 02:29 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
If you want to get rid of a new record without inserting it use clear record.
Re: Delete Option not Working [message #504304 is a reply to message #504303] Sat, 23 April 2011 02:43 Go to previous messageGo to next message
shanie
Messages: 118
Registered: January 2011
Senior Member
Actually I am checking the validation after leaving
the mandatory field empty and filling other fields
at the time of inserting a new record.

When I do this It is not allowing me to do any thing.
nor closing the application also.

This raise Form_trigger_failure has something to do with this
in when-validate-record.

How to sort this issue.
clear record makes no effect.

Regards,
Shanie
Re: Delete Option not Working [message #504352 is a reply to message #504304] Sun, 24 April 2011 00:24 Go to previous messageGo to next message
shanie
Messages: 118
Registered: January 2011
Senior Member
Please reply to the above issue.

Regards,
Shanie
Re: Delete Option not Working [message #504410 is a reply to message #504304] Mon, 25 April 2011 00:38 Go to previous messageGo to next message
shanie
Messages: 118
Registered: January 2011
Senior Member
shanie wrote on Sat, 23 April 2011 02:43
Actually I am checking the validation after leaving
the mandatory field empty and filling other fields
at the time of inserting a new record.

When I do this It is not allowing me to do any thing.
nor closing the application also.

This raise Form_trigger_failure has something to do with this
in when-validate-record.

How to sort this issue.
clear record makes no effect.


Please find the solution to this issue.

Regards,
Shanie
Re: Delete Option not Working [message #504413 is a reply to message #504410] Mon, 25 April 2011 01:06 Go to previous messageGo to next message
Michel Cadot
Messages: 68684
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Please stop raising your topic, it is counter-productive.
For myself, I will not have a look at it just because of this behaviour.

Regards
Michel

[Updated on: Mon, 25 April 2011 01:08]

Report message to a moderator

Re: Delete Option not Working [message #504429 is a reply to message #504413] Mon, 25 April 2011 05:05 Go to previous message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I think that this has gone too far, and (unfortunately) I don't see the light at the end of a tunnel.

The fact is: Forms Builder's "Data Block Wizard" will create both master and detail blocks, relationship between two of them, create all necessary triggers and procedures that will make a form perfectly OK, as far as the default behaviour is concerned. It means that you'll be able to insert records into a table, query existing records, update and delete them. No further coding from your side is necessary.

Now: I have no idea what you were doing in order to spoil those functionalities, but - perhaps you should simply throw existing form away and create a brand new one. Let Wizard do the dirty job. Make sure the form works OK. Then make it fancy, if you want (and know how).
Previous Topic: Dynamic List Items
Next Topic: developer 6i
Goto Forum:
  


Current Time: Mon Sep 16 21:20:49 CDT 2024