Returns from textToFilter only those characters specified in filterText, in the order they were originally entered in textToFilter.
Filter ( textToFilter ; filterText )
textToFilter
- any text expression or text field
filterText
- the characters to preserve in the specified text
text
FileMaker Pro 7.0
If filterText
doesn't have any characters, an empty string is returned. The Filter function is case sensitive.
Filter ( "(408)555-1212" ; "0123456789" )
returns 4085551212.
Filter ( "AaBb" ; "AB" )
returns AB.
The following example removes all text from the provided data, then formats the remaining numbers in the preferred phone number formatting:
Let (
phone = filter ( theField ; "0123456789" ) ;
"(" & Left ( phone ; 3 ) & ")" & Middle ( phone ; 4 ; 3 ) & "-" &
Middle ( phone ; 7 ; 4 )
)
If theField
contains Work: 408.555.1212 this calculation returns (408)555-1212.