Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Juggernaut

How to count total records

Featured Replies

  • Newbies

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.

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.)

  • Author
  • Newbies

Hi, Slim Jim

It works for me. Thanks a lot.

"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. :(

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.)

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.

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.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.