Home » Developer & Programmer » Forms » insert records which are checked
insert records which are checked [message #514883] Thu, 07 July 2011 03:23 Go to next message
goparaju
Messages: 54
Registered: June 2011
Member
Hi Experts,

I am working on form builder 6i. I have multi record datablock 't1'.'

I have 'Submit' Button, which contains 'commit_form'.

I am able to insert records.

Now i have a check box in data block, i want to insert records which are checked. I followed below thing to achieve that.

ON-INSERT Trigger:

If check_box ='Y' THEN
INSERT_RECORD
end if.

SUBMIT BUTTON: commit_form.

Let us say, i have 5 records, 2 records are checked, after clicking SUBMIT button, it's inserting 2 records only. But in console window, it's showing '5 transactions are saved'. I want see '2 transactions are saved' message in console window.

Could somebody help me how to get it or any other solution which will insert records which are checked and show correct message in console window.

Thanks in advance.

Re: insert records which are checked [message #514890 is a reply to message #514883] Thu, 07 July 2011 03:42 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
It has been discussed recently.
Re: insert records which are checked [message #514895 is a reply to message #514890] Thu, 07 July 2011 03:55 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
And here
Re: insert records which are checked [message #514898 is a reply to message #514883] Thu, 07 July 2011 03:58 Go to previous messageGo to next message
goparaju
Messages: 54
Registered: June 2011
Member
Hi,

Thanks for your response. I checked the thread you mentioned,but i didn't get any information needed.

Kindly help me.

Thanks
Re: insert records which are checked [message #514901 is a reply to message #514898] Thu, 07 July 2011 04:03 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
Have a read of the one I just posted for alternatives.
However I don't think you can get forms to show the correct message.
If you make it a non-database block and do everything through a button then you won't get that message at all.
If you base a block on a procedure it'll probably give you the count of all the records as you are getting now.
Re: insert records which are checked [message #514902 is a reply to message #514898] Thu, 07 July 2011 04:04 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Cookiemonster's link is far better than mine. It contains everything you need to solve the problem. True, no code in there - but, I guess you should do that part of the job, right? Guidelines are here, now apply them to your coding skills.
Re: insert records which are checked [message #514903 is a reply to message #514902] Thu, 07 July 2011 04:10 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
If you go with the non-database block and button you can always display your own message.
Re: insert records which are checked [message #514938 is a reply to message #514901] Thu, 07 July 2011 06:07 Go to previous messageGo to next message
goparaju
Messages: 54
Registered: June 2011
Member
Hi Experts,

Thanks for your support. To show proper message in console window,i want to delete records which are unchecked from the block t1.

For this,I have written below code in WHEN BUTTON PRESSED trigger.

go_block(t1);
first_record;
loop;
if check_box='N' THEN
delete_record;
end if;
EXIT WHEN :SYSTEM.LAST_RECORD='TRUE';
NEXT_RECORD;

end loop;

But it's not properly working. Let us say, if i have 4 records in block t1, if i click last 2 records and SUBMIT button.It's deleting 1st record only.

It's showing message '3 trasanctions are saved',and inserting only 2 records.

Could somebody help me why it's not deleting all records which are not checked.I hope if i can delete all records which are uncheked, i can get proper message in console window.

Thanks for your support.

Re: insert records which are checked [message #514940 is a reply to message #514938] Thu, 07 July 2011 06:27 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
You got that idea from my link?
Did you read my post in that thread that explains why that approach won't work?
Re: insert records which are checked [message #514945 is a reply to message #514940] Thu, 07 July 2011 07:24 Go to previous messageGo to next message
goparaju
Messages: 54
Registered: June 2011
Member
I didn't look at your link.Could you explain to me why it's not working.

Any other solution.

Thanks.
Re: insert records which are checked [message #514947 is a reply to message #514945] Thu, 07 July 2011 07:44 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
If you didn't read my link then why are you trying to use delete for an insert operation?
That was Littlefoot's suggestion in the link, and I explained in the link why it doesn't work.
Re: insert records which are checked [message #514997 is a reply to message #514947] Thu, 07 July 2011 10:52 Go to previous message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
It's not that it doesn't work - it works, but only in a special, ideal situation.

Something like Asterix, Obelix and the Romans. I don't remember how it really was, but - there was that Roman bartender who wanted to clear mess in his bar, so he took a bludgeon and hit a Roman soldier in his head - poor guy fell down. The bartender repeated the same action on another Roman soldier, with the same result. Then he hit Obelix into his head, and nothing happened. He hit him again - nothing. So he said: "It works, but not always".

Therefore, listen to what Druid says (i.e. Cookiemonster) and do what he says.
Previous Topic: How to SetSourceData into excel.chart in form6i
Next Topic: Error when running Forms 10g through web.
Goto Forum:
  


Current Time: Tue Sep 17 18:49:08 CDT 2024