Home » Developer & Programmer » Forms » Need help in Oracle Form Check box
Need help in Oracle Form Check box [message #669138] Wed, 04 April 2018 14:40 Go to next message
Djpats
Messages: 17
Registered: January 2018
Junior Member
Hi, Guys.
Need help in oracle forms checkbox...
I have Database databolck,having multiple records in it,
My current scenario is..
i have some user input fields and 2 more fields like revised invoice amount and credit amount in a datablock. These revised invoice amount and credit amount calculates amount dependns on procedure. Which i m calling in sibmit button.this means when i enter input values and press submit button credit amount and revised invoice amount calculated from procedure....this requirment is working fine for single record...


Now I have added check box to datablock,as non database item.

So,My requirment is like, When user check checkbox for multiple recods and press submit button, revised invoice amount and credit amount should be calculated for all the selected records....
how can i do this requirment.

Thanxxxx in advance... Any help will be appreciated..


Re: Need help in Oracle Form Check box [message #669145 is a reply to message #669138] Thu, 05 April 2018 02:59 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
Loop through the records in the block using first_record/next_record/exit when :system.last_record = TRUE
for each record check the value of the check box and call the procedure accordingly.
Re: Need help in Oracle Form Check box [message #669147 is a reply to message #669145] Thu, 05 April 2018 05:45 Go to previous messageGo to next message
Djpats
Messages: 17
Registered: January 2018
Junior Member
Hi Thnxxx for reply,
I m using below code but its not working...


GO_BLOCK ('BLOCK_NAME');

IF :BLOCK_NAME.CURRENT_RECORD_FLAG = 'Y'
THEN
l_record := :SYSTEM.cursor_record;
FIRST_RECORD;

LOOP
IF :SYSTEM.cursor_record <> l_record
THEN
:BLOCK_NAME.CURRENT_RECORD_FLAG := 'N';
END IF;

pkg_name.revised_invoice_amount ( PARAMENTERS & DTAILS TO CALCULATE REVISED INVOICE AMOUNT);


IF :SYSTEM.LAST_RECORD = 'TRUE'
THEN
EXIT;
END IF;

NEXT_RECORD;
END LOOP;

END IF;

GO_RECORD (:SYSTEM.cursor_record);
Re: Need help in Oracle Form Check box [message #669148 is a reply to message #669147] Thu, 05 April 2018 05:50 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
Your code checks if the record that's highlighted when the button is pressed has the checkbox checked and if so calls the procedure for all the other records in the block.

That doesn't match your requirements.
You need to ditch the initial IF - you should loop regardless of what the current record is.
The second if should be checking the value of the checkbox, not checking which row you're in.
Re: Need help in Oracle Form Check box [message #669149 is a reply to message #669148] Thu, 05 April 2018 05:53 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
This:
GO_RECORD (:SYSTEM.cursor_record);
does nothing.
It should be:
GO_RECORD (l_record);
Re: Need help in Oracle Form Check box [message #669150 is a reply to message #669149] Thu, 05 April 2018 08:44 Go to previous messageGo to next message
Djpats
Messages: 17
Registered: January 2018
Junior Member
Hi, Cookiemonster

I have tried as you said.

Error occerd
ORA 01422



Can u help me with the code


Thanks in advance
Re: Need help in Oracle Form Check box [message #669151 is a reply to message #669150] Thu, 05 April 2018 08:55 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
You need to show us the revised code.
Re: Need help in Oracle Form Check box [message #669152 is a reply to message #669151] Thu, 05 April 2018 08:57 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
ORA-01422 is "exact fetch returns more than requested number of rows"
You need a select statement (or insert/update/delete/merge with a sub-query) to throw that error.
Your posted code doesn't have anything like that so the error must have come from somewhere else - the procedure perhaps.
Re: Need help in Oracle Form Check box [message #669171 is a reply to message #669138] Fri, 06 April 2018 15:43 Go to previous messageGo to next message
Djpats
Messages: 17
Registered: January 2018
Junior Member
Hi, thanks for your reply.

i have attached submit button code,
PFA.



thanks in advance
Re: Need help in Oracle Form Check box [message #669172 is a reply to message #669171] Fri, 06 April 2018 15:49 Go to previous messageGo to next message
Djpats
Messages: 17
Registered: January 2018
Junior Member
/foru/forum/fa/13811/0/

in addition to above code..attached Screen shot of form

in Cr_Details Block i have added 1 chk box.. as a non db item

When user check checkbox for multiple records and press submit button, revised invoice amount and credit amount should be calculated for all the selected records.
Re: Need help in Oracle Form Check box [message #669193 is a reply to message #669172] Sun, 08 April 2018 04:33 Go to previous messageGo to next message
Djpats
Messages: 17
Registered: January 2018
Junior Member
Hi,Guys
Waiting for Reply.
Re: Need help in Oracle Form Check box [message #669204 is a reply to message #669193] Sun, 08 April 2018 07:48 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Any SELECT (apart from the obvious ones) that can return more than a single row are candidates for the TOO-MANY-ROWS error, *including* the procedure code you didn't post. In my opinion - no, don't post it. 300 lines of a trigger is probably too much as well.

Which Forms version is it? You should debug it, either by including MESSAGE calls within that code so that you'd know where the execution currently is, so - once it fails - you'll know which SELECT you have to investigate. If you're on Forms 10g onwards, there's the Debug mode - set the breakpoint at the beginning of the trigger code and trace its execution.

This won't fix the error, but: all those SELECT ... FROM DUAL at the beginning could/should be rewritten, for example
No : SELECT TRUNC (SYSDATE, 'Month') INTO l_first_day FROM DUAL
Yes: l_first_day := trunc(sysdate, 'Month');
Re: Need help in Oracle Form Check box [message #669213 is a reply to message #669193] Mon, 09 April 2018 02:47 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
Unfortunately I can't access attachments.
So you need to post the code directly in the thread in [code] tags
Re: Need help in Oracle Form Check box [message #669313 is a reply to message #669193] Sun, 15 April 2018 00:03 Go to previous message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Please read OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
If you don't know how to format the code, learn it using SQL Formatter.

And FEEDBACK to and THANK people who take time to help you.

Previous Topic: Facing compilation errors with Oracle forms 11g
Next Topic: urdu language
Goto Forum:
  


Current Time: Thu Mar 28 04:37:28 CDT 2024