Here is an example of what I want to do in a custom function.
At the moment, it is done by a script :
Thanks in advance for your ideas
Perhaps this one:
http://www.briandunning.com/cf/250 JoinRepetitions ( repeatingField ; delimiter; start ; nRepeats )
You can search the site for other possibles.
If you can be certain that every repetition in your first field has a value, you can make the second field a calculated repeating field with this formula:
Let ( [ ~rep = Get ( CalculationRepetitionNumber ) ; ~field = List ( tablename::repeatingField ) ; ~left = LeftValues ( ~field ; ~rep ) ; ~left = Left ( ~left ; Length ( ~left ) - 1 ) ; ~eval = Substitute ( ~left ; "¶" ; "+" ) ] ; Evaluate ( ~eval ) )
Let ( [
~rep = Get ( CalculationRepetitionNumber ) ;
~field = List ( tablename::repeatingField ) ;
~left = LeftValues ( ~field ; ~rep ) ;
~left = Left ( ~left ; Length ( ~left ) - 1 ) ;
~eval = Substitute ( ~left ; "¶" ; "+" )
Evaluate ( ~eval )
Great! that works
thanks a lot
I'm glad it helps. Note that this may fail if any of the repetitions are blank. You can get around this by adding a go-between calculation field something like:
repeatingFieldCalc (calculated, number, repeating) = repeatingField + 0
and then referencing "repeatingFieldCalc" in your running total field.
This will work with even with blank values where Numbers is the repeating field your looking to do a cumulative summary of and RepeatingSum is a field of calculation type with repetitions.
this.rep = Get ( CalculationRepetitionNumber ) ;
prev.rep = this.rep - 1 ;
prev.sum = If ( prev.rep > 0 ; RepeatingSum[prev.rep] ; 0 ) ;
current.value = Numbers[this.rep] ;
this.sum = current.value + prev.sum
Thanks to your suggestions,
I have decide to no use a custom function but to calculate the cumulative summary directly in the field of calculation as it is shown below:
Cas(Obtenir ( NombreRépétitionsCalcul )=1;repeatingfield;
Obtenir ( NombreRépétitionsCalcul )>Multivaluee ( numberofrepeatition );"";
Obtenir ( NombreRépétitionsCalcul )>1;cumulativerepeatingfield[Obtenir ( NombreRépétitionsCalcul )-1]+repeatingfield)
Retrieving data ...