DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: Count Records in Form?

  1. #1
    Join Date
    Jul 2001
    Posts
    334

    Count Records in Form?

    Hi,
    Please consider simple example of developer/2000 Form6i and emp table.

    I want to display record according to the below sample. Can any one help how it is possible count(*) in Form.
    e.g
    deptno 10
    # of emp 3


    **** I know how to check in Reports but how it is possible in FORM, no idea.

    SQL> select deptno, count(*) no_of_emp from emp
    group by deptno;

    DEPTNO NO_OF_EMP
    --------- ---------
    10 3
    20 5
    30 6

    Thanks in advance.

  2. #2
    Join Date
    Sep 2001
    Location
    NJ, USA
    Posts
    1,287
    Simplest way to do that is:

    1) dept is a base table for a block
    (with select ... from dept ...)
    2) in this (dept) block u have to create not database field :cnt for example.
    3) create POST-QUERY trigger for block dept,

    POST-QUERY trigger:

    begin
    select count(*) into :dept.cnt from emp where deptno = :dept.deptno;
    end;

    that is it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width