Scripts that remove text?
I imported in data that has " " quotes around each phone number. I want to remove the quotes. Could I do that by using a script and how?
Replace field contents can modify the data in a field for every record in your found set. Use Show All records to pull all records in your table into the found set. Changes made by Replace Field Contents cannot be undone so make a back up copy of your file first.
Using the calculation option in replace field contents, the following expression should remove all quotation marks from your file:
Substitute ( YourTable::YourFIeld "\"" ; "" )
But more than one character can be used as quotation marks (such as left and right smart quotes) so you may have to experiment a bit to get this to work with your particular data.
I got a dialogue box that said
An operator (e.g. +, -, *, …) is expected here.
and it highlighted "\""
I left out a semi-colon:
Substitute ( YourTable::YourFIeld ; "\"" ; "" )
PhilM - I use this a lot. In your expression -
I wondered how you would "quote" the quotes, but how does the \ work?
That's what makes it possible to quote the quotes in my expression. The backslash, \ , is called the "escape character", when used inside quoted text, it tells FileMaker, take the following character as a character and not the operator that marks the end of a quoted text string. For that reason, if you really want the backslash in your quoted text, you have to double it: \\ in order for Filemaker to evaluate it as a single \.
You can also use this expression: Substitute ( YourTable::YourFIeld ; """" ; "" )
Where the quotes are used twice to get FIleMaker to see them as a single double quote character. But \" seems a bit easier to read so I use it.
Retrieving data ...