Brian Dunning's FileMaker Custom Functions

Coalesce ( values )

Returns the first non-empty value, similar to the SQL COALESCE function

  Be the first to rate this function Log in to vote

Mislav Kos   Mislav Kos - Show more from this author
Soliant Consulting
https://www.soliantconsulting.com/

Share on Facebook Share on Twitter

  Sample input:
Coalesce ( "¶¶A¶¶B" )
  Sample output:
"A"

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

Similar to the SQL COALESCE function, this custom function will return the first non-empty value from the list of values passed in through the parameter.

 

Comments

Sam Barnum   Sam Barnum, 360Works
Nov 21, 2019
You can also use the `List` function for this, as it does not append empty values. e.g.

GetValue ( List ( "" ; "" ; "" ; "four" ) ; 1) // "four"
 
Mislav Kos   Mislav Kos, Soliant Consulting
Nov 21, 2019
Yes, that would work well if you're building the list yourself. There may be occasions when you receive a list of values from somewhere else.
 
Kyle Williams   Kyle Williams, Augusto Digital
Feb 4, 2020
I usually use a RemoveEmptyValues custom function for this and then GetValue(List,1) to get the first value, but this works too.. Thank you Mislav.
 

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 20 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: