Brian Dunning's FileMaker Custom Functions

GetNumberRepetitionsInMultivalue ( _Multivalue )

returns the number of not empty repetitions in a multivalue

  Average rating: 4.4 (31 votes) Log in to vote

Maryse Charbonneau   Maryse Charbonneau
ACA
http://-

Share on Facebook Share on Twitter

  Sample input:
GetNumberRepetitionsInMultivalue ( multivalue)
  Sample output:
3

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

Returns the number of not empty repetitions in a multivalue field. Useful if you have a script that must add values inside a multivalue and you want to know right away in which repetition to add it.

 

Comments

comment   comment, VR
May 1, 2010
Why not simply:

Count ( repeatingField )


"... you want to know right away in which repetition to add it."

You are assuming (a) that the non-empty repetitions are consecutive, and (b) that the field has at least one more repetition.
 
Maryse Charbonneau   Maryse Charbonneau, quebec
May 1, 2010
Yes, you must first test if this function isn't equal to the max of your multivalue. If it is, you show a dialog to the user saying he cannot add because maximum number of values is already reached, if not, you add.
In the code, I give a special button to remove values, if the value isn't the last one, the script move all the values inside previous repetition in order to not have a "hole" inside the multivalue.
 
Bruce Robertson   Bruce Robertson
May 2, 2010
Why not just valueCount( List( _Multivalue )) ?
 
Bruce Robertson   Bruce Robertson
May 2, 2010
Also note that if you are dealing with repeating text fields, it is possible for the cell contents to have return in it. So you could have two filled cells but 10 returns.
 
comment   comment, VR
May 2, 2010
"Why not just valueCount( List( _Multivalue )) ?"

Well, sure: why use only one function when you can use two?
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Under construction. Email me your wish list for improvements.