10 Replies Latest reply on Oct 5, 2015 4:00 PM by dgreensp

    Display Hyphenated Names

    beacon10

      Title

      Display Hyphenated Names

      Post

           I have figured a way to display a hyphenated name in general.

           My problem is that what I want is a data entry field. I turned on Title Case in Menu formatting but that doesn't capitalize the first letter of the second part of the hyphenated name. How do you get the second name of a hyphenated name to display correctly (first letter capitalized) in a data entry field?

        • 1. Re: Display Hyphenated Names
          beacon10

               Here's an image

          • 2. Re: Display Hyphenated Names
            schamblee

                 Your image is missing.   If you want the first letter of a field to be capitalized then use auto-enter calculation. Proper(Self) then remove the check from the check box do not replace existing value.

            • 3. Re: Display Hyphenated Names
              philmodjunk

                   No image shows, but an auto-enter calculation could handle a single instance of a hyphen pretty easily. If you need to have this work for an unknown number of hyphenations, you may want to set up a custom function (requires FileMaker Advanced).

                   Let ( [ p = Position ( self ; "-" ; 1 ; 1 ) ;
                              L = Length ( self ) ;
                              s2 = Proper ( Right ( self ; L - p ) )
                           ] ;
                            If ( p ; proper ( Left ( self ; p ) ) & s2 ; Proper ( self ) )
                           ) // Let

                    

              • 4. Re: Display Hyphenated Names
                beacon10

                     That's nearly exactly what I figured out as to how to get a properly displayed hyphenated name.

                     I still have the problem: As an input text field, where do put that code to make it display in the edited text field.

                     I tried as a calculated value defining the field but that did not work. Do I need to create another field, modify the name and then replace the original? 

                     I did try that and my same Last Name edit field remains the same.

                • 5. Re: Display Hyphenated Names
                  philmodjunk

                       Find the field in Manage | database | fields and double click it to open field options. Then select the calculation option on the auto-enter tab.

                       Please note that this will modify new data, but data in existing records will remain unchanged. You may want to use replace field contents with a very similar calculation (but no "self") to update them.

                  • 6. Re: Display Hyphenated Names
                    beacon10

                         AWESOME!- it fixed all the hyphenated names in my 23k name database!  Thank you! I was close with what I had (at least on the right track). If I can ask one more question about your code. Using "self" - is that how you refer to the field name you are modifying? I've always used the field name in the calculation but if this is the case, it would be simpler to use "self." I've seen "self" in some of the other examples and was not sure how it was being used.

                         Thanks again!

                    • 7. Re: Display Hyphenated Names
                      philmodjunk

                           self is pretty self explanatory. wink

                           In an auto-entered calculation and a conditional format expression, it can be used in place of naming the actual field and this can also produce an expression that you can paste into the calculation dialog of multiple fields without needing to modify it after pasting.

                      • 8. Re: Display Hyphenated Names
                        schamblee

                             In my test, my calculation capitalizes each name no matter the number of hyphenations.  Am I missing something.

                             Auto Enter Calculation

                             Proper(self)

                             then uncheck do not replace existing value.  My formula seem shorter and easier to use.

                        • 9. Re: Display Hyphenated Names
                          philmodjunk

                               Sounds like I am missing the obvious here. I'd assumed that this would match what Brad Kinne had reported as not working. blush

                          • 10. Re: Display Hyphenated Names
                            dgreensp

                            This is an amazing solution.  Thank you to everyone!

                            How do you deal with a similar solution in a data entry field when someone is entering a last name for McGee or MacGregor and the G has to be capitalized.