Jump to content

Count records based on specific criteria


Recommended Posts

Gents,

my Category field has: Phones, TVs and Laptops. 

I'd like to display on my layout the amout of Phones, TVs and Laptops in the current DB. 

For all I know is that I need to create three variables and use Insert Merge Field option to paste those into layout. 

How should the formula look? 

Link to post
Share on other sites
Posted (edited)

There are many ways you could accomplish this. Perhaps you could explain why and when you need this, so that we can tell which ways are better for your situation than others. Note that there is a difference between counting records in the current found set vs. counting records in the entire table. Another significant difference is between a "live" count that updates itself at all times vs.a scripted count that is produced on demand.

 

Edited by comment
Link to post
Share on other sites
54 minutes ago, comment said:

explain why and when you need this

I need to know at glance how many specific items I have.

55 minutes ago, comment said:

counting records in the entire table

that's what I need

56 minutes ago, comment said:

a "live" count that updates itself at all times

exactly!

Link to post
Share on other sites

Here's one way you could accomplish this:

  1. Define a table of Categories and populate it with 3 records: Phone,TV and Laptop;
  2. Define a relationship between your existing table (Products?) and Categories, matching on Category;
  3. Add a calculation field to the Categories table = 
    Count ( Products::Category )
  4. Define another relationship between Products and a new occurrence of the Categories table, using the x relational operator;
  5. Place a portal to the new occurrence of the Categories table on the layout of Products; put the Category field and the calculation field inside this portal.

 

 

 

Link to post
Share on other sites

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.