SetVar ( InValue )
Assign value to a variable, making sure variable exists if value is empty.
Average rating: 4.9 (14 votes) Log in to vote
Richard DeShong - Show more from this author
Logic Tools http://logictools.com |
SetVar ( "" )
"Empty"
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
This is complementary to the SetField() function.
Both SetField() and SetVar() use the text string "Empty" to indicate no value.
The idea is, when I set variable, I want the variable to exist. But if the source data (such as a field) is empty, then FM does not create the variable. Of course, you can use IsEmpty() to test, but I prefer to be able to see the variable in the Data Viewer. So SetVar() sets the variable to "Empty" if the source has no value. And SetField() understands that it should return "" if the variable is "Empty".
Example:
If a field, table::MyField, is empty, and I use SetVar(),
$MyVariable = SetVar( table::MyField )
Then $MyVariable is now = "Empty".
SetVar() and SetField() are used in LIST functions, which are designed to work with variables and the "Empty" idea.
ListAdd(), ListAddUnique(), ListExist(), ListGet(), ListToggle().
Comments
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.