Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

How to count total records


This topic is 7044 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

Hi, all,

I tried count (field) and it always return 1 although I changed several fields. Does any one know how to count the total number of records in a database. It should very easy but I just can not get it. thanks.

Posted

Make a second occurrence of your table and relate them by X so all records are related to all records. Call the second table occurrence Counter. Then count(Counter::field) will give you the total number of records. (I'm sure there are other ways of doing it.)

Posted

"how to count the total number of records in a database."

Ummm, maybe Get(TotalRecordCount) would do what you wish also? If you use a self-join to count, remember to count a field which always contains something, like a serial or ID. If the field being counted is empty, it won't, ummm, count. :(

Posted

I thought there might be other ways of doing it.

I keep a cartesian join alongside most of my tables for ID control. So it is natural to use it for table stats, and I do count the ID field (Should have mentioned that, thanks for pointing it out.)

Posted

I've tried to respond to this once already so if this is a repeat - apologies.

I knew there would be other methods.

I keep a cartesian join alongside most of my tables for ID control so it is natural to also use it for full table stats. I do count the record ID and I should have said that. Many thans for pointing it out.

Posted

For large tables, counting through the relationship will end up slowing things down unnecessarily. It's better to use the Get() function in this case.

This topic is 7044 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.