Brian Dunning's FileMaker Custom Functions

NumReps

FieldName

  Be the first to rate this function Log in to vote

John Segers   John Segers - Show more from this author

  Sample input:
NumReps ( FieldName)
  Sample output:
26

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

Returns the actual repetitions of a field used. In my case I defined a field with 50 repetitions. Some of the repetition field are empty, 26 are used. So it returns 26

 

Comments

Richard DeShong   Richard DeShong, Logic Tools
Sep 30, 2026
Hello John Segers, a few thoughts:
Primarily, the built-in Count() function will return the count of reps with valid data.

So even though this CF is not needed, the following thoughts are meant to be helpful design considerations:
1) The function does not consider the data in the repetitions: what if a rep contains a ¶.
If you purposely designed it with expectation that reps would not contain a ¶,
then remember to mention it in the description.
2) Counting the pilcro (¶) characters, in a list, returns one-less than the number of values.
So if any reps contain a value, then you would need + 1.
But if no reps contain a value, then it should return zero.
You could use: Case( IsEmpty( FieldName ) ; 0 ; ).
3) Remember to check the "data type returned" for the function:
List() returns a text string, so you don't need GetAsText().
 
John Segers   John Segers
Sep 30, 2026
Thank you Richard, for taking time to pointing that out to me. I don't think it's a good idea to remove my function, that would be a kind of "historical falsification" but I will add an caution. I'm really greatful for your peer review
 
John Segers   John Segers
Sep 30, 2026
But in my defence (but I know you didn't attack) Count ( field {; field...} ) the syntax is of this function is a little confusing. It suggests several fields or at least several records. And that's the way I used to use it, for counting the number of records of a certain defenition (if that makes any sense). However, when I looked up the function in 'help' it does mention repetitions
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 22 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: