Home » Developer & Programmer » Forms » Unable to insert checbox checked records (Forms 10g)
Unable to insert checbox checked records [message #508613] Mon, 23 May 2011 07:49 Go to next message
oracle_qns
Messages: 9
Registered: May 2011
Junior Member
Hi,

i have a multi-record block with a check box(:B_ASTHEAD.CB_CHECK) for each record.
user can select the record by clicking on the check box.
when checked, value is 'Y' and when unchecked, value is 'N'.

when user clicks on 'OK' button (when button pressed trigger), the records which are
selected(Checkbox) must be posted to the database table.


L_last_Rec number;
L_first_Rec number;
L_AST COP_DETL.AST%TYPE;
BEGIN
Go_Block('B_ASTHEAD');
Last_Record;
L_last_Rec:= :system.trigger_Record;
First_Record;
L_first_Rec:= :system.trigger_Record;
For i in L_first_Rec..L_last_Rec-1 Loop
if :B_ASTHEAD.CB_CHECK = 'Y' then
--insert into asn_invoiced (asn,item,invoice_ind) values (:ASN_SELECT.ASN,:ASN_SELECT.ITEM,'Y');
insert into ast_temp values (:B_ASTHEAD.AST);
end if;
Next_Record;
End Loop;
commit;
message('complete');
END;

The issue here is , check box selected records are not getting inserted
into table when OK button is clicked and i could see that all
checked checkboxes become unchecked immediately
. But if i comment the
--"if :B_ASTHEAD.CB_CHECK = 'Y' then "
part, then insert works , but inserts all record.
Can anybody guide me to insert only checkbox selected records.
Re: Unable to insert checbox checked records [message #508614 is a reply to message #508613] Mon, 23 May 2011 07:53 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
There is nothing in the posted code that will cause the behavour you describe.
So preseumably some code in some other trigger is the culprit.
Run the form in debug mode to see what is firing.
Re: Unable to insert checbox checked records [message #508615 is a reply to message #508614] Mon, 23 May 2011 07:55 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
What happens if you - instead of
if :B_ASTHEAD.CB_CHECK = 'Y' then
use
if checkbox_checked
built-in? (See its use in Forms Help)
Re: Unable to insert checbox checked records [message #508626 is a reply to message #508615] Mon, 23 May 2011 08:50 Go to previous messageGo to next message
oracle_qns
Messages: 9
Registered: May 2011
Junior Member
Hi,

i tried with check_box checked and debug mode, but i could not see the expected result. What is concerning me why check box gets unchecked on clicking OK button.
There is no other code in the when button pressed trigger of "OK" button and no other trigger associated to check box or OK button.

Re: Unable to insert checbox checked records [message #508628 is a reply to message #508626] Mon, 23 May 2011 09:04 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
So when you ran it in debug mode and pressed the button - did no other trigger fire?
Re: Unable to insert checbox checked records [message #508630 is a reply to message #508628] Mon, 23 May 2011 09:14 Go to previous messageGo to next message
oracle_qns
Messages: 9
Registered: May 2011
Junior Member
When OK button was pressed , debug message popped up for each record in the block as per the loop logic,after showing up the last debug message for last record, the check box too disappeared.
Re: Unable to insert checbox checked records [message #508632 is a reply to message #508630] Mon, 23 May 2011 09:17 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
Would that be a when-new-record-instance or when-new-item-instance trigger firing?
Re: Unable to insert checbox checked records [message #508633 is a reply to message #508630] Mon, 23 May 2011 09:18 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
oracle_qns wrote on Mon, 23 May 2011 15:14
the check box too disappeared.


I assume you mean the check box got unchecked. If it actually disappeared that'd be a different problem.

EDIT: typo

[Updated on: Mon, 23 May 2011 09:19]

Report message to a moderator

Re: Unable to insert checbox checked records [message #508634 is a reply to message #508633] Mon, 23 May 2011 09:20 Go to previous messageGo to next message
oracle_qns
Messages: 9
Registered: May 2011
Junior Member
Does the check box got to do some property setting with the block it belongs?
Except check box , all other items are database items.
Re: Unable to insert checbox checked records [message #508636 is a reply to message #508634] Mon, 23 May 2011 09:26 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
If it's a database block why are you using an insert statement rather than insert_record?
Re: Unable to insert checbox checked records [message #508637 is a reply to message #508636] Mon, 23 May 2011 09:34 Go to previous messageGo to next message
oracle_qns
Messages: 9
Registered: May 2011
Junior Member
Because the insert has to be in a temporary table.
Re: Unable to insert checbox checked records [message #508643 is a reply to message #508637] Mon, 23 May 2011 09:56 Go to previous message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
So?
If it's a database datablock then a commit will cause it to issue an insert_record command. This is in addition to any insert statement you code.
If you want it to only insert on the insert statment then it shouldn't be a database datablock.
Previous Topic: Raise Error Message
Next Topic: Button
Goto Forum:
  


Current Time: Sat Sep 07 15:34:12 CDT 2024