I want to use both the Proper and Substitute text functions so that a name field has the first letter capitalized and carriage returns are removed. I can get both functions working independantly but nothing when I try to combine them.
Wrap one function inside another.
Substitute ( Proper ( text ) ; searchString ; replaceString )
Thanks I was doing one then the other.
You could also do it the other way.
Proper ( Substitute ( text ; searchString ; replaceString ) )
Or do this:
Proper ( GetValue ( text ; 1 ) )
You can wrap functions just like Josh showed you. I personally love the Let function and often just wrap things inside of it. It also makes it easier for testing in the dataviewer. While this is simple, sometimes I'll have 20 calcs in a let and looking for errors using the data viewer is easy since you can just change the result to see calcluations in the middle of the Let.
Let ( [
F1 = TextField ;
F2 = Substitute ( F1 ; ¶ ; "" ) ;
F3 = Proper ( F2 )
Note that for some silly reason, FileMaker does not require double quotes around the ¶ (return) character. Always been interesting. You could also have searched for Char (13) instead of ¶. That is the ASCII equivalent.
Thanks for bringing up the Let function. I used to wonder why developers had the fascination with Let, until I really "got it" - you can save yourself from having to re-evaluate chunks of a calc if you need to call it multiple times (like if your calc has a lot of Case statements), but it can also clean up things to make complex calcs much more readable.
To that end, I personally prefer to give my Let variables some more context than F1, F2, etc., for the sake of readability, but that's just me.
As for the no quotes around the ¶ symbol, I believe that if you put it in quotes, it's actually looking for the text of the ¶ symbol, like it appears in the text here… versus looking for an actual return character. I could be mistaken.
Message was edited by: flybynight
A single paragraph symbol will be automatically quoted by the parser, so the quotation marks are optional. When using multiple paragraph symbols to insert multiple breaks, all of the symbols must be quoted. We quote all of our paragraph symbols (single or multiple) both for consistency and to make a clearer visual distinction between string constants and actual operators.
To use a literal paragraph symbol, escape it with a preceding backslash, as in "\¶".
There was a time when the ¶ character required quote marks, but that changed (possibly undocumented) a number of FileMaker versions ago — don't recall exactly which version. I do remember the first time I "accidentally" forgot to quote a ¶ and the calculation worked anyways. It was a head-scratcher moment.
And don't forget that Proper ( "McDonald" ) may not be proper. Same thing with O'Reilly, and many, many more.
I find the SmarterProper CF very useful for this sort of situation - it allows you to specify exceptions (like "McD", "UK", etc.). It's available on the Brian Dunning site, here.
Retrieving data ...