SwitchKey ( Process ; TheKey ; ValueToSet ; OptionalValue
Toggling, adding or deleting a key value
Average rating: 4.3 (29 votes) Log in to vote
Ugo Di Luca - Show more from this author
DLSYSTEMS http://www.dlsystems.fr |
or
SwitchKey
("Add";CategoryField;"Theatre";"")
Add "theatre" to the CategoryField if not already in the list, delete it if already inside)
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
The "Add" process is suitable for multiline keys/lists whereas the "Toggle" acts on single line key field.
The OptionalValue should be set to "" for the "Add" process.
Using this key as the definition of a SetField [ ] allows to cover both actions withing a single script command, not to mention that you may dynamically switch method through script Parameters.
Comments
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.