Home » Developer & Programmer » Forms » how to count the no of rows in a block before inserting (forms 6i)
how to count the no of rows in a block before inserting [message #392153] Mon, 16 March 2009 11:43 Go to next message
mohaninforakle
Messages: 55
Registered: January 2009
Member
hai experts,

I want to find out the no of rows in a particular block before inserting.Because i have a requirement that min 3 records must be inserted so i want to validating no of rows.Please help anybody ...
Re: how to count the no of rows in a block before inserting [message #392155 is a reply to message #392153] Mon, 16 March 2009 12:05 Go to previous messageGo to next message
ghulam
Messages: 2
Registered: March 2009
Location: UK
Junior Member
PLEASE REPLACE 'BLOCK_TO_BE_CHECKED' WITH YOUR BLOCK NAME AND 'TEST_VARIABLE' WITH A REQUIRED VARIABLE IN THE SAME BLOCK.

I HOPE THIS IS IT WHAT YOU ARE LOOKING FOR.
declare
count number;

begin
go_block('BLOCK_TO_BE_CHECKED');

FIRST_RECORD;
count := 0;
loop
IF :BLOCK_TO_BE_CHECKED.TEST_VARIABLE IS NOT NULL THEN
COUNT := COUNT+1;
END IF;

if :SYSTEM.LAST_RECORD = 'TRUE' then
EXIT;
ELSE
NEXT_RECORD;
end if;

END LOOP;
MESSAGE('NUMBER OF ROWS UPDATED BY USER ='|| COUNT);
END;
Re: how to count the no of rows in a block before inserting [message #392176 is a reply to message #392155] Mon, 16 March 2009 17:05 Go to previous message
Littlefoot
Messages: 20892
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
That's unnecessary complex solution; it is easier to do it using Forms built-ins:
go_block('your_block');
last_record;

if to_number(:system.trigger_record) < 3 then
   message('Not enough records');
   raise form_trigger_failure;
end if;
Previous Topic: cursor is not working ?
Next Topic: Summary Field Validation!
Goto Forum:
  


Current Time: Mon Dec 05 02:29:38 CST 2016

Total time taken to generate the page: 0.08233 seconds