ClearRepeatingVariable ( variableName ; startIndex ; endIndex )
Clears a range of repetitions for a specified variable
Average rating: 4.7 (29 votes) Log in to vote
Kevin Frank & Associates
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
I recently found myself needing to clear a whole bunch of repeating variables, and wrote this CF to make my life easier.
Dec 8, 2011
ClearRepeatingVariable ( "$$test" ; 3 ; 1 )
that would only clear rep 3?
|Kevin Frank, Arcata, CA
Dec 8, 2011
|ClearRepeatingVariable ( "$$test" ; 3 ; 3 )|
|Howard Schlossberg, FM Professional Solutions
Aug 14, 2015
|Thanks for this, Kevin. I tweaked it slightly to meet my current need, which is that I don't KNOW what my endIndex is. I DO know that there will never be blanks, so I added an option so that it will keep clearing repetitions until it gets to the first blank and it can then assume it is at the end. A simple change that may be helpful to someone...
/* Howard added: if endIndex = "end" then keep going until the FIRST blank repetition */
Let ( startIndex = Max ( 1 ; startIndex ) ;
Evaluate ( "Let ( " & variableName & "[" & startIndex & "] = \"\" ; \"\" )" ) &
endIndex < 0 and endIndex <> "end" ; "" ;
endIndex ≥ 0 and startIndex ≥ endIndex ; "" ;
endIndex = "end" and IsEmpty( Evaluate( variableName & "[" & startIndex+1 & "]" ) ) ; "" ;
ClearRepeatingVariable ( variableName ; startIndex + 1 ; endIndex )
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.