Home » Developer & Programmer » Forms » how to count record in a block?
how to count record in a block? [message #324152] Sat, 31 May 2008 03:34 Go to next message
mm_kanish05
Messages: 487
Registered: January 2007
Location: Chennai
Senior Member

Hi

How to count the record in block (which having multi records)?. Is there any specific function for the same.

Or We want to do manually.


kanish

Re: how to count record in a block? [message #324161 is a reply to message #324152] Sat, 31 May 2008 03:51 Go to previous messageGo to next message
azamkhan
Messages: 548
Registered: August 2005
Senior Member
you have to do it mannually there is no function for this
Re: how to count record in a block? [message #324169 is a reply to message #324152] Sat, 31 May 2008 04:05 Go to previous messageGo to next message
mm_kanish05
Messages: 487
Registered: January 2007
Location: Chennai
Senior Member

Ya Correct, I Make just confirm like u people.

Any I wrote a function in Pl/sql Libraries

    FUNCTION Blockcount (Ablk object) RETURN Number IS
   cnt number := 1;
BEGIN
   go_block(Ablk);
   First_Record;
   Loop
   	  If :System.Last_Record = 'TRUE' Then
   	  	 Exit;
   	  End
   cnt := cnt + 1;
   End Loop;   
   Return cnt;
END;


1. First Can we pass "block" as parameter. If ok "Object" type is correct as per my coding.

2. How to call the procedure
but im calling like
Declare
	   Cblkcnt Number;
	   Pblkcnt Number;
Begin 
	   cblkcnt := Blockcount('CvpuPart');
End;


but im getting error blockcount must declared.

please guide me

Thank

kanish
Re: how to count record in a block? [message #324222 is a reply to message #324152] Sat, 31 May 2008 13:05 Go to previous messageGo to next message
urnikhil
Messages: 42
Registered: March 2008
Member
Kanish,

why don't you get the count using a SQL query based on the table which your block reflects to... I mean if your block is based on table name "KANISH_TABLE" then do a query like this..

SELECT COUNT(*)
INTO CNT
FROM KANISH_TABLE
(U can include a where condition if u want to..)

Otherwise if you want to know the number of the current record in the block u can use "CURRENT_RECORD" built in...

I think this help you...

- Nik..
Re: how to count record in a block? [message #324306 is a reply to message #324169] Sun, 01 June 2008 22:55 Go to previous messageGo to next message
azamkhan
Messages: 548
Registered: August 2005
Senior Member
Instead of using a procedure or a select statement. Use a parameter datatype NUMBER and use a POST-QUERY at block level.

In the POST-QUERY trigger you increment the parameter by 1.

But remember you have to make the block property to "Query All Records" to YES.
Re: how to count record in a block? [message #324332 is a reply to message #324152] Mon, 02 June 2008 00:58 Go to previous message
mm_kanish05
Messages: 487
Registered: January 2007
Location: Chennai
Senior Member

Im using control block and not a datablock

Eventhough Thanks all you people, I got it

Kanish
Previous Topic: UNIQIUE NUMBER
Next Topic: How to convert date twice without using extra variables
Goto Forum:
  


Current Time: Thu Dec 08 16:08:43 CST 2016

Total time taken to generate the page: 0.07850 seconds