Home » Developer & Programmer » Forms » Oracle Forms check Box / submit button (Oracle 6i)
Oracle Forms check Box / submit button [message #562470] Wed, 01 August 2012 10:37 Go to next message
katangur.nikethan
Messages: 31
Registered: December 2009
Location: Hyderabad
Member
hello,

I am new to forms,
My requirement is I have placed a check Box in the Detailed Block and i have assigned values for the check box as

Checked - R
Unchecked - P
Initial Value - R

by default the check box would be displayed as Checked while inserting the values in to table the value of check box is not getting inserted but when the check box is unchecked the the value is getting inserted as P when the submit button is pressed

Please help me as soon as possible

Thanks in Advance,
K Nikethan Reddy


[MERGED by LF]

[Updated on: Mon, 06 August 2012 01:42] by Moderator

Report message to a moderator

Re: Oracle Forms check Box [message #562484 is a reply to message #562470] Wed, 01 August 2012 11:19 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Until someone smarter than me answers your question, here's what I can say about the issue: I don't know how to make the "Initial value" work as expected. Therefore, I use a workaround: I set it manually. For example, WHEN-NEW-FORM-INSTANCE trigger or WHEN-CREATE-RECORD or WHEN-NEW-RECORD-INSTANCE and any other you find appropriate:
if :block.checkbox is null then
   :block.checkbox := 'R';
end if;
or even
if not checkbox_checked('block.checkbox') then
   :block.checkbox := 'R';
end if;
Re: Oracle Forms check Box [message #562531 is a reply to message #562484] Thu, 02 August 2012 00:50 Go to previous messageGo to next message
katangur.nikethan
Messages: 31
Registered: December 2009
Location: Hyderabad
Member
Hi Littlefoot,

Thanks for The Fast Reply

It Has been Working But there is a Small Issue with it

If I have Checked 3 Values out of 5 Values then all the 5 Values are getting inserted as R and wise versa, my actual Requirement is i need to insert 3 records as R and rest of the 2 records as P

I am Attaching the Code below

Thanks in Advance,
K Nikethan Reddy


 first_record;
        loop    
        	
        	if :MCH_ADITOR_BILL.status is not null then
   		:MCH_ADITOR_BILL.STATUS := 'R';
        	else
        		:MCH_ADITOR_BILL.STATUS := 'P' ;
        		
      end if;
              insert into mch.MCH_CHECK_INWARD_DTL 
              (CHK_INWARD_ID,INVOICE_ID,BILL_NO,AUDIT_INWARD_NO,AUDIT_INWARD_DATE,AUDIT_OUTWARD_NO,
                  AUDIT_OUTWARD_DATE,STATUS,CHECK_INWARD_NO,CHECK_INWARD_DATE,CUR_RECORD_FLAG,ORG_ID,CIRCLE) values
                (HDR_ID,:MCH_ADITOR_BILL.INVOICE_ID,:MCH_ADITOR_BILL.BILL_NO,:MCH_ADITOR_BILL.INWARD_NO,:MCH_ADITOR_BILL.INWARD_DATE,:MCH_ADITOR_BILL.OUTWARD_NO,
                    :MCH_ADITOR_BILL.OUTWARD_DATE,:MCH_ADITOR_BILL.STATUS,SEQ_INWARD_NO,sysdate,'Y',:MCH_ADITOR_BILL.ORG_ID,:AUDITOR.CIRCLE);



  standard.commit;
    

exit when :system.last_record='TRUE';
next_record;

end loop;
Re: Oracle Forms check Box [message #562539 is a reply to message #562531] Thu, 02 August 2012 01:40 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
If I understood what you are saying, you'd want initial value to be P, not R.
Re: Oracle Forms check Box [message #562542 is a reply to message #562539] Thu, 02 August 2012 01:47 Go to previous messageGo to next message
katangur.nikethan
Messages: 31
Registered: December 2009
Location: Hyderabad
Member
yes

if there are 5 values displayed in detailed block in that 5 value user would be selecting 3 lines as checked and rest of the 2 as unchecked,while inserting the values should be inserted as 3 values as R and 2 values as P

but values are getting inserted as R for all the 5 records

Re: Oracle Forms check Box [message #562544 is a reply to message #562542] Thu, 02 August 2012 01:49 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Did you modify
if :block.checkbox is null then
   :block.checkbox := 'R';
end if;
to
if :block.checkbox is null then
   :block.checkbox := 'P';
end if;
Re: Oracle Forms check Box [message #562552 is a reply to message #562544] Thu, 02 August 2012 04:00 Go to previous messageGo to next message
katangur.nikethan
Messages: 31
Registered: December 2009
Location: Hyderabad
Member
Thanks,it Has been Working

One more Query Has been Found out While Testing

The End user Would be selecting the required data check the check box & then press the Submit button if the user press the button for single time then there is no problem it is getting inserted fine if by mistake the user pressed the button for 2 time then the records are getting inserted multiple times

For example the records displayed in the Detailed block is 3 if the user has submitted the data then 3 records should get inserted in to the table by mistake if the user presses the button for 2 times then the records are getting inserted 6 times

Thanks in Advance
K Nikethan Reddy
Re: Oracle Forms check Box [message #562553 is a reply to message #562552] Thu, 02 August 2012 04:14 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Does it mean that you are manually inserting records into a table? If so, why? Default Forms processing - on a data block - supports querying, updating & deleting old records as well as inserting new ones. You don't have to code that, not a single line - Forms does all of that for you.

If you chose to do that manually (for some reason) (i.e. using INSERT INTO statement), then you have to worry about duplicates and prevent it programatically. If you created unique/primary key (or even index), it would prevent duplicates as well (not very user-friendly, though).
Re: Oracle Forms check Box [message #562798 is a reply to message #562553] Sun, 05 August 2012 08:56 Go to previous messageGo to next message
katangur.nikethan
Messages: 31
Registered: December 2009
Location: Hyderabad
Member
hi,

Sorry For the Late Reply,

Yes i am inserting the records manually,because While retrieving the data data would be retrieved from another table and inserted in to another table

If there is any Another way to do Please let me Know & How can we Know whether there are any changes done in the form
before data get committed, if there are changes then the data gets inserted else it should not get inserted.

Thanks in Advance
K Nikethan Reddy
Oracle Forms Submit Button [message #562813 is a reply to message #562470] Mon, 06 August 2012 00:12 Go to previous messageGo to next message
katangur.nikethan
Messages: 31
Registered: December 2009
Location: Hyderabad
Member
Hi

I am New To forms

I have Developed a new Form,if the user clicks the submit button the data gets inserted in to a table,if the user submits the data for multiple times then the data gets inserted multiple times,i need to restrict the insertion if there are no changes in the form

Hope for the Early Reply,

Thanks & Regards
K Nikethan Reddy,
Re: Oracle Forms Submit Button [message #562819 is a reply to message #562813] Mon, 06 August 2012 01:41 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
It seems that you are inserting records into a table manually (i.e. using INSERT INTO statement). Is there any reason for doing that?

If possible, recreate the form in order to use default Forms functionalities - base a block on a table (i.e. use a "data block", not "control block") and let Forms do all that (query, insert, update, delete) for you - you don't have to write a single line of code and, above all, you'll avoid situations like the one you are in now.

[EDIT] I didn't realize that it is you, who already posted the same question couple of days ago. Anyway, as you can see, I didn't change my mind. How about you?

[Updated on: Mon, 06 August 2012 01:43]

Report message to a moderator

Re: Oracle Forms Submit Button [message #562820 is a reply to message #562819] Mon, 06 August 2012 01:46 Go to previous message
katangur.nikethan
Messages: 31
Registered: December 2009
Location: Hyderabad
Member
Thanks for the Early Reply,

K i will Try by Building a data block for the table and do the insertion

Thanks in advance
K Nikethan Reddy
Previous Topic: After LOV
Next Topic: CheckBox controls column values
Goto Forum:
  


Current Time: Thu Jul 04 16:03:45 CDT 2024