LastRepNumber ( repeatingField ; maxRepeat )
Returns the number of the last not empty repetition
Average rating: 3.9 (44 votes) Log in to vote
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
Returns the number of the last not empty repetition, much like Last(repeatingField) returns its contents.
Can be used with both 7 and 8 version of FileMaker, but is most useful with 8, where fields can be reached specifying the repetition number by a calculation.
For example, to set the next empty repetition to "whatYouWant" you can use:
Set Field [repeatingField [LastRepNumber ( repeatingField ; 10 ) +1];"whatYouWant"]
(where repeatingField has 10 rep).
This function comes in hand also if you want to clear all repetitions.
A simple loop:
Exit Loop if [LastRepNumber ( repeatingField ; 10 ) = ""]
Set Field [repeatingField [LastRepNumber ( repeatingField ; 10 )];""]
Mar 20, 2014
Does not work if the repeatingField is referencing another repeatingField that is a calculation.
This recursive function will return an incorrect number (always blank), since during the recursion, the repeatingField has not yet caluclated the result from the other repeatingField.
Only works with repeatingField that are not based on other calculations.
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.