Brian Dunning's FileMaker Custom Functions

sumreps ( rfield ; from ; to )

Sums repeating field rep values from rep `from` to `to`

  Average rating: 4.6 (25 votes) Log in to vote

Oliver Reid   Oliver Reid - Show more from this author

Share on Facebook Share on Twitter

  Sample input:
sumreps(field;4;6)


where field is (1,2,3,4,5,6)
  Sample output:
15

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

Handy function to sum a subset of repeating field reps

 

Comments

Matthew Fero   Matthew Fero, Seattle
Dec 31, 2012
This is exactly what I was looking for. However, the function seemed to be broken until I changed 'rfield' to 'GetFieldName ( rfield )' ... as follows:

Let ( [
nn = If ( to ≠ ""; to - from + 1 ; 200) ;
xx = Evaluate( "MiddleValues (List (" & GetFieldName ( rfield ) & ");" & from & ";" & nn &")" );
lln = Length (xx) - 1 ;
uu = Left (xx ; lln)
] ;
Evaluate( Substitute(uu ;¶;"+")) )
 
oliver   oliver
Dec 31, 2012
rfield should be inserted in quotes actually: I have added a note to clarify that.
 
Martin   Martin
May 20, 2013
Does not work if some of the repetitions are empty
 
oliver   oliver
May 20, 2013
That's true Martin. I will fix when I figure that out.
One could use as an argument that is the Max of the intended rep field and another that contains only 0's
 
Jim   Jim, NY
Oct 19, 2014
Dosent work at all!
 

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 20 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: