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

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

Recommended Posts

Posted

Is there a way to get a sum of all the records in a database with a specific value in a specific field without having to go to find mode. For example, I am creating a stats page for the database I am working on. On this stats page I want to know the total number of records that have the color field set to red and how many records have it set to blue. Is there a way to auto-enter this info in rather than going to find mode searching, copy, paste.

Heathbo

Posted

Here's how I'd do it (i've attached an example)...

Make a self-joining relationship with a global set to "1", or between two tables, doesn't matter.

Then on the table your report will use, make a calculation for each color you want to report on:

colors.fp7.zip

Posted

Thank you, I've got it working now just perfectly. I have one more question. What if I wanted to add more values that are not in the same value list. For example: There is another value list(Flower, Fruit). I wanted to know the sum of all the records that are Red(in one drop down list) and Flower(in another drop down list). I assume its a small modification to the sumRed field calculation.

Thanks for your time

Heathbo

Posted

Using the same logic, you could have a "FlowerIsRed" calculation field, =

Case ( color="red" and Type = "Flower" , 1, 0 )

Then Sum that field, using your constant self-join relationship.

There is another more flexible method, if you were wanting to get a sum from choices the user was making at that moment. But the above is probably the fastest and best for reports. Hopefully you have only a few choices, as the combinations will multiple rapidly.

Posted

I wonder whether, with a lot of combos, you mighty not be better off doing this -

Define Result [Calculation] = Left(Colour, 1) & Left(Type, 1)

and Criterion as a global, set to contain what ever combo you want.

Define a self-join Criterion to Result.

Then use Count(SelfJoin::Result)

You might need to fiddle with the definition of Result to account for 'Black' and 'Brown', etc.

This topic is 7445 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.