Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

how do I count unique values being viewed?


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

Recommended Posts

Posted

Example:

A view has a list of items that have been ordered from a company. Each item is attached to an order with an order_id relating the items file to the orders file.

How would I count the number of orders BEING VIEWED? That is, I need a global count of something like sum(unique(order_id))

Am I making any sense?

Thanks for any help you beautiful people.

-wald

Posted

Give each record an auto entered, sequential, ascending, unique record ID (RecordID). Create the relationship:

SelfByOrderID with Order ID matching Order ID in the same file.

Create a field:

Flag (calculation, number) = (RecordID = Min(SelfbyOrderID::RecordID)

The sum of Flag is the number of unique order id's.

-bd

Posted

Not straightforward ...

I'd use a script looping thru records, setting a global field to the order ID of the record and increasing another global field each time a different order ID is encountered ....

or

Copy the orderIDs of the selected records into a global text field, creating a multi-line key, relate this global field to the orderID of Orders and use a calc

Count (ThisRelationship::OrderID)

  • 2 weeks later...
Posted

That doesn't work because the min function gives the min of all entries in the table, not the min of the found set which is what I need.

Any suggestions?

I really don't want to use a loop, because that would slow things down too much.

Thanks a bunch

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