SetRepeatingVariable ( variableName ; valueName ; startIndex ; endIndex )
Sets a range of variable repetitions to a specified value
Average rating: 4.5 (29 votes) Log in to vote
Kevin Frank - Show more from this author
Kevin Frank & Associates https://filemakerhacks.com |
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
I do a lot of charting using variable arrays, and frequently I need a placeholder value, such as the word "null", in any array rep that doesn't contain data. I used to populate these placeholder reps using a scripted loop, but with this CF, a single line of code is all it takes.
Comments
John Leyman, John Leyman Nov 28, 2011 |
||
Beautiful! An easy way to reset a global variable. | ||
Bruce Robertson Dec 4, 2011 |
||
Fatal flaw; always hits recursion limit. Original example file posted elsewhere works fine but this part of expression does not match the original. endIndex = 0 and startIndex = endIndex In original file it was: endIndex ≥ 0 and startIndex ≥ endIndex |
||
Kevin Frank, Kevin Frank & Associates Dec 4, 2011 |
||
Thanks Bruce. Code has now been updated. It must have gotten munged when I pasted it in to submit it here, because as you point out, it was correct in the original version. This time around I'm using ">=" so am optimistic that the problem has been solved. Regards, Kevin |
||
Bob Dec 8, 2011 |
||
So If I SetRepeatingVariable ( "$$test" ; "MyField" ; 3 ; 1 ) It would put the contents of MyField in Rep 3 (only) of the $$test variable? |
||
Kevin Frank, Kevin Frank & Associates Dec 8, 2011 |
||
Not exactly... first off, if you only want to set rep 3, then you want "3 ; 3" as the final two arguments... because the starting and ending reps are both 3. The point is to specify a range of reps. Next, since you've wrapped "MyField" in quotes, it will be treated as a text string, so you would end up with "MyField" in $$test[3], assuming you started with SetRepeatingVariable ( "$$test" ; "MyField" ; 3 ; 3 ) Hope this helps, Kevin |
||
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.