Brian Dunning's FileMaker Custom Functions

|| ( A ; B )

Perl-style or to select values. This is particularly useful for falling back to defaults values.

  Average rating: 5.0 (1 vote) Log in to vote

belg4mit   belg4mit - Show more from this author

Share on Facebook Share on Twitter

  Sample input:
||( Field; "Default")
||( 0; 2)
||( 1; 2)
  Sample output:
"Default" // If Field is false (0 or empty)
2
1

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

Perl-style or to select values. Rather than FileMaker's native C-style "or", which casts values to binary for evaluation, || treats non-zero, non-empty values as truth and returns these true values as the result of the expression. This is particularly useful for falling back to defaults values.

 

Comments

belg4mit   belg4mit
Mar 17, 2023
A potentially more compact alternative is here https://www.briandunning.com/cf/1126 although it is recursive and results in indirection
 

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: