This is a very basic FileMaker technique but is a very popular " how do I?" question among new FileMaker users. The entire question is " How do I get a count of all the rows in a portal?"
The answer is to use one of the aggregate family of functions called Count. It will give you a count of the number of a times a related field has data within it. So your calculation will look something like ...
Count ( field in a relationship )
So the basic steps are ...
1) Go To Manage Fields (Define Fields pre FileMaker 9) and create A Calculation Field
2) In the upper right corner of the Manage Calculation dialog box, double click the Count selection. This will add the following in the edit calculation dialog box ...
and the field section will automatically be highlighted.
3) In the upper left corner of the Manage Calculation dialog box, choose the relationship used in the portal from the pull down menu above the list of fields.
4) Double click the field you want to count. This should fill out the rest of the calculation.
5) Add the field to your layout and test it!
NOTE: If that field is empty but the row is in a portal ... it will not be counted. So in many cases, you will want to count the auto enter primary key field. That should never be empty in any table.
NOTE: You can also add teh @@ symbol in a portal row to see the row number for each portal.
An example file can be downloaded by clicking (here)
© 2010 - Dwayne Wright - dwaynewright.com
The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.