3 Replies Latest reply on May 31, 2017 2:10 AM by MarkEaston_1

    How do I display a name field with the first letter always capitalised?

    AM_1

      Title

      How do I display a name field with the first letter always capitalised?

      Post

      I have a simple name field which I want to display in a list.

      I would like the name to be displayed with a capital at the begining, whether or not it was entered with a capital.

      So for example someone enter the name in text as "smith" but I want it to be shown as "Smith".

      I suppose there might be two general ways:

      1. To change the data on input so that even if someone type "smith" it is entered as "Smith"

      or 

      2. To store the data however it was entered (either "smith" or "Smith") but to change the way it was displayed.

      What would be the best out of these two aproaches and how would you go about actually achieving this?

      Thanks

        • 1. Re: How do I display a name field with the first letter always capitalised?
          philmodjunk

          Both 1) AND 2) are possible and both have their uses depending on what you will do with these names.

          1) can be done with an auto-enter calculation:

          Proper ( Self )

          and clear the "do not replace existing value..." option.

          2) can be done by selecting the field while in layout mode and specifying "Title Case".

          Both options have a key short coming when it comes to names: Names do not follow predictable rules for how they are capitalized.

          Both options would turn a name like McDaniels into Mcdaniels.

          You may want to use either this auto-enter expression:

          Upper ( Left ( Self ; 1 ) ) & Right ( Self ; Length ( Self ) - 1 ) )

          or this conditional format expression:

          Exact ( Upper ( self ) ; Self ) or Exact ( Lower ( self ) ; self )

          And then specify the Title Case format.

          This last option leaves the capitalization unchanged any time a mix of upper and lower case letters are entered, but capitalizes only the first letter if all caps or no caps are used during data entry.

          • 2. Re: How do I display a name field with the first letter always capitalised?
            AM_1

            I do like the last option; this seems to give the best overall performance.

             

            Thanks!

            • 3. Re: How do I display a name field with the first letter always capitalised?
              MarkEaston_1

              Hi AM_I

              philmodjunk's code works well but if you need to trim the spaces as well (as most users seem to love their space bars!) this works well for me:

               

              Enter this as an Auto-Entered Calculated Value in (fieldname):

               

              Let (varfirst = Proper(fieldname) ; TrimAll (varfirst; 0 ; 0 ))

               

              Where:

              varfirst' is my variable name.

              'fieldname' = the field you want to sort out.

               

              It does change MacDougal to Macdougal though. My view was that I prefer names with the first letter always capitalised rather than have folk be able to put in something like joHNSon. As always with Filemaker, a personal choice.

               

              Hope it helps.