SumRepetition ( Field ; Repetition ; RecordCount
Sums an individual repetition through a relationship.
Average rating: 4.0 (41 votes) Log in to vote
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
If you try to use SUM on a related repeating field, Filemaker will sum the entire contents of every repetition on a record and then for all related records when in fact you wanted the sum of repetition 2 for the related records.
Larry Goldman, Silicon Valley
Mar 18, 2014
|Absolutely brilliant! A real FileMaker breakthrough!|
Jun 2, 2014
|I want example for sum with repetition field|
Lon Cook, San Francisco
Oct 24, 2014
GetFieldName ( Extend ( R::field_nr ) )
; Get ( CalculationRepetitionNumber )
; Count ( Extend ( R::id ) )
Mar 18, 2016
Great function. I found that when summing a repeating field in a related table and there are no related records, I get the beach ball (OS X, FMP 14.0.5). I found adding a Case() to the CF to trap for no related records fixed the problem.
GetAsNumber( recordCount ) + 0 > 0 ;
r = repetition;
f = field ;
fr = GetField ( f & "[" & r & "]" );
cnt = recordCount
If (cnt > 0 ; GetNthRecord ( fr ; cnt ) + SumRepetition ( f ; r ; cnt - 1 ) ; 0 )
) // end Let
) // end Case
Rob, Cleveland, OH
Mar 19, 2016
|Vaughan, its sounds like you have another issue going on there. That's exactly that the If(cnt>0... is supposed to take care of.|
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.