Count ( RelatedTable::FIeld )
produces a count of all related records where Field is not empty.
Count ( RepeatingFIeld ) // in same table
produces a count of all repetitions that are not empty
So it makes sense to me that Count ( RelatedTable::RepeatingField ) returns the count of the number of not empty repetitions over all the records in the related set of records.
And then if the field is global, it would follow that you'd get Number of related records * Number of Not Empty repetitions.
So the techs that work for FileMaker may disagree, but I'm predicting that they'll indicate that this is "as designed".
Thank you for your post.
"PhilModJunk" is correct (Thank you). A field defined for global storage assigns the same value across all records. Using your example, the two repeating values appear in the three records for table A. That is, two repeating values in record 1, two repeating values in record 2, and two repeating values in record 3 for a total of six values. This is "as designed"
A regular way to reach your goal is to create a global calculation field in the same table where is the repeating field, in order to count its number of non empty repetitions.
I would use an unstored calculation field rather than one with global storage specified.
Mmmh... But the "only" purpose of a global calculation is to do calculation about other global fields...
Could you develop your opinion ?
I was expecting a different behavior with global field, due to the different characteristic of a global field.
But, this is "as designed" and I will use a different solution.
I will probably use a something like this
Count ( RelatedTable::RepeatingField ) / if ( count (RelatedTable::Field) > 0 ; count (RelatedTable::Field) ; 1)
Go to layout RelatedTable
Count ( RelatedTable::RepeatingField )
Go To Original layout
I chose to create a custom function that I can use anywhere
But… i really don't see the interest of a custom function (CF) in this case, since the matter here is the context, not an heavy formula; and in particular, a CF haven't context, in contrary to a calculated field.
Because i'm sure i misunderstood you, what is the formula of your CF ?
Oh, and please note that a Global Calculation can also be called from anywhere… It was precisely the reason of my first suggestion !
it is very simple and it works everywhere
FieldG id the global field
RefField is a any field in the related table