2 Replies Latest reply on Jan 24, 2011 10:17 AM by raybaudi

    How can I count the number of records in a table?

    HowardRathbun

      Title

      How can I count the number of records in a table?

      Post

      I have used the count(table) function several times and sometimes I get the right answer and sometimes not.  I can't find a get function to do the job but there ought to be a simple solution to this problem.

        • 1. Re: How can I count the number of records in a table?
          Sorbsbuster

          If you have found all the records then Get (FoundCount ) will return the number of records in the table.  Otherwise it will return the number in the current found set.

          If you don't want to use that then you could create a self-join relationship to the table itself, using a Constant field (eg: cConstant = 1) and then use the function

          Count ( MyTable:cConstant::SelfByConstant:cConstant )

          This will count every record in that relationship (ie: all records in the table) that have a value in the field cConstant (ie: every record).

          • 2. Re: How can I count the number of records in a table?
            raybaudi

            "...sometimes I get the right answer and sometimes not"

            To get the total record count, you'll need to use a calculation with the function Get ( TotalRecordCount ), paying attenction that that calculation must be UNSTORED ( Storage Options... of that field definition )