Skip to content

Instantly share code, notes, and snippets.

@jarbro
Last active September 1, 2016 18:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jarbro/e46c9c394da4ac80d455a476f6707964 to your computer and use it in GitHub Desktop.
Save jarbro/e46c9c394da4ac80d455a476f6707964 to your computer and use it in GitHub Desktop.
Substituting multiple items in FileMaker

Substituting multiple items in FileMaker

Source

substitute ( text ; searchString ; replaceString ) This function replaces the “search-sting” by specific “replace-string” in your text.

Example

If you have colors as “Red” & ¶ & “Green” & ¶ & “Blue” & ¶ & “Yellow” and you want to replace the text “Red” as “R” then the syntax will be

substitute (“Red” & ¶ & “Green” & ¶ & “Blue” & ¶ & “Yellow” ; “Red” ; “R” )

or

 Let ( colors = “Red” & ¶ & “Green” & ¶ & “Blue” & ¶ & “Yellow” ; Substitute ( colors ; “Red” ; “R” ))

For multiple substitute if you have colors as “Red” & ¶ & “Green” & ¶ & “Blue” & ¶ & “Yellow” and you want to replace “Red” as “R”, “Green” as “G”, “Blue” as “B”, and “Yellow” as “Y” in a single calculation follow the below method.

Let ( colors = “Red” & ¶ & “Green” & ¶ & “Blue” & ¶ & “Yellow” ; Substitute ( colors ; [“Red” ; “R”]; [ “Green”;”G”]; [“Blue”;”B”]; [“Yellow”;”Y”] ))

In the substitute function the string inside the [“”; “”] is treated as one condition,you can add multiple conditions separated by semicolon “;” as [“”; “”]; [“”; “”]; [“”; “”]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment