2 Replies Latest reply on May 30, 2013 12:55 AM by Fred(CH)

    Using TextStyleAdd versus Text formatting functions

    BryanN

      Title

      Using TextStyleAdd versus Text formatting functions

      Post

           In order to provide consistency, I want to ensure most of my fields are formatted with proper noun forms (first letter capitalized with any styles removed).  Trying to prevent guys coming in with ALLCAPS and pasting in making our DB look ugly.

            

           In this case is it better to use TextStyleAdd( TextFormatRemove (self) ; Titlecase) or would it be better to use Proper ( TextFormatRemove (self) )?

            

           Also, is there any way that I can do a combination where if "ABC Waflles Inc." is entered, it doesn't come out as "Abc Waffles Inc."?  I tried doing TextStyleAdd ( TextFormatRemove (self) ; Titlecase + Uppercase ) but it ended up underlining the text instead.

        • 1. Re: Using TextStyleAdd versus Text formatting functions
          philmodjunk

               TextStyleAdd( TextFormatRemove (self) ; Titlecase) and Proper ( TextFormatRemove (self) )

               produce identical results so there is no advantage/disadvantage to either.

               What you describe could be accomplished with a recursive custom function that loops through the text one word at a time and assigns a text format to each individual word as it does so. This requires FileMaker Advanced to do so and is unlikely to be perfect in its results. Consider such things as the different ways a surname like MacDonald can be capitalized.

               Exact ( text ; upper ( text ) )  can detect if text is all upper case and Exact ( text ; lower ( text ) ) can detect if text is all lower case. This gives you the option of applying titlecase only if text is all caps or no caps.

          • 2. Re: Using TextStyleAdd versus Text formatting functions
            Fred(CH)
                 Hello guys,
                  
                 Excuse me but, if you permit, i would like to add some comments about all this :
                  
                 1 )

                  

                 
                      TextStyleAdd( TextFormatRemove ( self ) ; Titlecase ) and Proper ( TextFormatRemove ( self ) )
                 
                       
                 
                      produce identical results so there is no advantage/disadvantage to either.
                      Not exactly : as you know, it proceed at different levels (Data and Formatting are not the same). So the differences between them will be context-depending. For instance :
                      • When you remove the text style (for instance with a copy paste or with Format Menu)
                      • When you export your data
                      • When you re-proceed the data in another calculation (for instance to use Upper, that will "seem" fail, if some data is formatted lowercase)

                       

                      2 ) If i understand correctly the sense of original post, it could be named like this :

                       

            Using TextStyleAdd ( Text ; TitleCase ) or Proper ( Text ) ?

                       

                      For the rest, Big Up Phil, for the end tip you provided : great mind !

            yes

                      Thanks, Fred

            PS : Sorry to come here even the Post is checked OK. But i would initially create a new post to help a friend and i found this that appear almost perfect...