Brian Dunning's FileMaker Custom Functions

FirstValidRepValue

Returns the first valid value from a list of values in a repeating field

  Be the first to rate this function Log in to vote

simes   simes - Show more from this author

  Sample input:
R1=empty, R2=empty, R3="1", R4="2"
  Sample output:
1

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

If you have values in a repeating field and you need to get the first valid value but ignore any empty repetitions, the GetValue function can do this, FirstValidValue wraps this into a custom function.

 

Comments

Richard DeShong   Richard DeShong, Logic Tools
Oct 16, 2025
Hello simes, sorry I am bit confused by the sample input, is this supposed to represent a field with 4 repetitions? If so, is "R1+0" a typo?
Also, if it does represent 4 repetitions, why would List() not include the first two repetitions, since they have a value of zero. I get that if they were empty, then List() would not include them. I guess, more specifically, what do you consider "valid".
 
simes   simes
Oct 17, 2025
Sorry, typo, should have been R1=0.
Empty = NotValid
From what I can see GetValue returns Valid if any data has been entered into a rep field with a carriage return (which is added via 'List'). So NotValid if empty, but Valid if "0" or any other data is entered. Perhaps I should correct this to: R1=empty, R2=empty, R3="1", R4="2". I am using this on manual entry fields, not tried calculated fields.
 

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.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 21 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: