Home » Developer & Programmer » Forms » Clear Record processing alternate records- URGENT
Clear Record processing alternate records- URGENT [message #86260] Wed, 15 September 2004 11:29 Go to next message
Samir Patel
Messages: 8
Registered: March 2002
Junior Member
I have a datablock with 10 records displayed and a Checkbox which the user clicks.

The system should clear the records that are checked and leave the ones that are not checked on the datablock.

The code only does half the number , rounds to next whole number and processes the records checked and leaves the other half unprocessed . For ex, if i check 7 records , 7/2 = 3.5 rounds to 4 and it clears 4 records and leaves the other 3 records on the

datablock .

My variable l_row_cnt will give me the number of checked rows processed .

Can someone please give me a solution to this problem......

Basically i am trying to do row by row processing and clear the records that are checked . What is the correct way to do this?

 

Please let me know soon.

Thanks,

Samir.

 

DECLARE
 v_last_record BOOLEAN;
 v_exit_loop   BOOLEAN;
 v_comments    varchar2(200);

l_proj_cnt number ;

BEGIN
  v_last_record := FALSE;
  v_exit_loop   := FALSE;
  l_proj_cnt    := 0;

   
 GO_BLOCK('B_CAPITAL_PROJECT_ID');

 First_record;

  
  LOOP --Start loop and check if Checkbox for Retired is enabled and for the records that
         --it is enabled, send the data to the retired table.
        

   IF (:B_CAPITAL_PROJECT_ID.CBX_1 =  'Y') THEN
      
      
         l_proj_cnt := l_proj_cnt + 1;  
         clear_record;
   END IF ;
    

    IF v_last_record THEN
          v_exit_loop := TRUE;
    ELSE

   Next_record;

        IF :System.Last_Record = 'TRUE' THEN
          v_last_record := TRUE;
        END IF;
    END IF;
    
     EXIT when v_exit_loop;
      
  END LOOP;

show_message('SUCCESSFULLY RETIRED -- ' || l_proj_cnt || ' Award Project to RETIRED TABLE');

END;

 

 
Re: Clear Record processing alternate records- URGENT [message #86265 is a reply to message #86260] Wed, 15 September 2004 21:18 Go to previous messageGo to next message
Narendra K.
Messages: 18
Registered: June 2003
Junior Member
Dear friend,

Try the following code, which is tailored from ur
code.

DECLARE
l_proj_cnt number := 0;

BEGIN

GO_BLOCK('B_CAPITAL_PROJECT_ID');

First_record;


LOOP --Start loop and check if Checkbox for Retired is enabled and for the records that
--it is enabled, send the data to the retired table.

IF :System.Last_Record = 'TRUE' THEN
exit;
END IF;

IF (:B_CAPITAL_PROJECT_ID.CBX_1 = 'Y') THEN


l_proj_cnt := l_proj_cnt + 1;
clear_record;
END IF ;
next_record;
END LOOP;
---- Check for last record ----
IF (:B_CAPITAL_PROJECT_ID.CBX_1 = 'Y') THEN
l_proj_cnt := l_proj_cnt + 1;
clear_record;
END IF ;

show_message('SUCCESSFULLY RETIRED -- ' || l_proj_cnt || ' Award Project to RETIRED TABLE');

END;


Hope it will solve ur query.

have a nice day,
Narendra
Re: Clear Record processing alternate records- URGENT [message #86273 is a reply to message #86265] Thu, 16 September 2004 05:23 Go to previous messageGo to next message
Samir Patel
Messages: 8
Registered: March 2002
Junior Member
Hi Narendra,

Thanks for the reply.

Unfortunately the code you modified and sent works only if Alternate records are checked.

Try to check all the records on the datablock and all Records do not get cleared from the datablock.

The code i have written also works fine if alternate records are checked.

The actual problem lies in the way Forms handles record by record processing.

Since we use NEXT_RECORD to navigate to the next record and IF the current record was checked , we CLEAR the record , the pointer to the record now skips one record and processes the next one because of NEXT_RECORD.

Please let me know if you concur .

Thanks,
Samir Patel.
Re: Clear Record processing alternate records- URGENT [message #86274 is a reply to message #86260] Thu, 16 September 2004 07:12 Go to previous message
Samir Patel
Messages: 8
Registered: March 2002
Junior Member
I got the solution .

I am only going to process and clear when the record is checked,
The next_record condition will be placed in the ELSE part of the IF statement .

Hope i am clear.

I am sending the modified code for others to use.
Thanks,
Samir.

DECLARE

l_proj_cnt number(6) := 0;

BEGIN

GO_BLOCK('B_CAPITAL_PROJECT_ID');

First_record;

LOOP --Start loop and check if Checkbox for Retired is enabled and for the records that
--it is enabled, send the data to the retired table.

IF :System.Last_Record = 'TRUE' THEN
exit;
END IF;

IF (:B_CAPITAL_PROJECT_ID.CBX_1 = 'Y') THEN

l_proj_cnt := l_proj_cnt + 1;
clear_record;

else
next_record;
END IF ;

--

END LOOP;
---- Check for last record ----
IF (:B_CAPITAL_PROJECT_ID.CBX_1 = 'Y') THEN
l_proj_cnt := l_proj_cnt + 1;
clear_record;
END IF ;
END;
Previous Topic: listbox
Next Topic: Urgent PLease give reply immediately
Goto Forum:
  


Current Time: Sun May 19 08:05:32 CDT 2024