Oracle forms Check box Manipulation [message #626962] |
Wed, 05 November 2014 13:56 |
|
Asfakul
Messages: 43 Registered: July 2014
|
Member |
|
|
HI all,
I have a form in which there is a check box(select all) which if selected selects all the records.
I am trying to implement the feature where if I unselect any of the record, select all check box would get un checked. here is my code so far
declare
L_ind char(1):='Y';
L_rec_count NUMBER:=0;
begin
go_block('b_search_result');
last_record;
L_rec_count:=:system.last_record;
first_record;
if :b_action.cb_select_all='Y' then
for c in 1..L_rec_count
loop
go_record(c);
if :b_search_result.cb_select_single='N' then
L_ind:='N';
end if;
end loop;
end if;
if L_ind='N' then
:b_action.cb_select_all:='N';
end if;
exception
when others then
message(sqlerrm);
raise form_trigger_failure;
end;
which is throwing the error NO DATA FOUND. I dont know how this error is being generated. Please help. Also let me know how can I check the value of an intermediate variable in a form?
.fmb file is attached for your reference.
[Updated on: Wed, 05 November 2014 13:57] Report message to a moderator
|
|
|
Re: Oracle forms Check box Manipulation [message #626963 is a reply to message #626962] |
Wed, 05 November 2014 15:11 |
joy_division
Messages: 4963 Registered: February 2005 Location: East Coast USA
|
Senior Member |
|
|
I didn't look at your code too close as it would be hard to follow without the form and I am not downloading the form.
you do not mention anything about if any of the fields are database or non-database fields, whether the "all" field is in the same block or another, etc.
For me, if any of the checkboxes are unchecked, all you do is somthing like:
:block.the_all_field := NULL;
QED
|
|
|
|
|
|
|
|
|
Re: Oracle forms Check box Manipulation [message #627092 is a reply to message #627058] |
Fri, 07 November 2014 03:18 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
The first IF statement is pointless since you do the same code in both sections of IF.
The simplest way to loop over records is:
first_record;
LOOP
<do_stuff>
EXIT WHEN :system.last_record = 'TRUE';
next_record;
END LOOP;
You don't have anything to put the cursor back in the record it was in at the start, it'll always end up in the last record regardless of which record the user had last selected.
And as LF pointed out above you don't need to do any looping at all. You could just set the select all checkbox when one of the detail checkboxes is changed.
|
|
|
|
|
|