14 Replies Latest reply on Apr 20, 2017 3:42 PM by BrettMilne

    How can I format field to auto capitalize text?

      In Panorama, this is so simple it takes a second to set the style of a field. But I can't find it in FMP. I want Name entries to be automatically capped, so if I type "norton" it turns into "Norton" when user tabs to next field. I'm probably overlooking something obvious, but that isn't uncommon these days....

        • 1. Re: How can I format field to auto capitalize text?

          Well, as soon as I asked, I found a sort of answer. One can set "styles" for a field in an inspector operation. However, it doesn't have "Sentence case" which is unfortunate, because one encounters names like Pierre de Sade, and the "de" then has to be handled separately.

           

          It also appears that it only operates on the display of each field. And that combinations of fileds do NOT keep the displayed capitalization. So, if I set my first and last name fields to be word capped, in another field where I combine those fields with other address data for a complete address field with three lines -- the last name shown in caps in the lastname field will NOT show that way in the Address field. Now, I could format the address field to use word caps, but then that would mess up the items that should be ALLCAPS, like state abbreviations.

           

          Looks like an unfortunate bug until I find a workaround.

          • 2. Re: How can I format field to auto capitalize text?
            jjfcpa

            There are actually two ways (perhaps more) to handle this.

             

            1.  You can set this as an auto-enter calculation by going to the Manage Database option, select the table containing the field you want to apply this calculation to, then select the field.  Click the Options button for the field and in the Auto-Enter tab, check the Calculated value and enter the following in the calculation area.

             

            Proper ( field )

             

            Naturally, you'll select the field from the fields on the left side of the calculation screen.

             

            This calculation will be applied whenever this field has data entered in it or modified.

             

            2.  The second way also uses the Proper() function but instead of applying it as an auto-enter calculation, you enter it as a script trigger.  To do this, go to the layout where the field resides, right-click on the field and select "script trigger".  Check the "On ObjectSave" script trigger and it will ask you to select a script to run just before saving any data entered or modified in this field.

             

            You need to click the + button to create a new script.  Name it something like "ST - Proper Case" so you can identify it as a script trigger and what it does, changes text to proper case.  The only thing that needs to be entered in the script is the following.

             

            set field

             

            You don't need to specify a target field because it will apply the calculation to the active field if you don't select one.

             

            For the calculation you enter:  Proper( Get(ActiveFieldContents) )

             

            The choice is yours, you can use whatever method you prefer.  My preference is to use the script trigger to handle these kinds of issues.

            • 3. Re: How can I format field to auto capitalize text?
              ch0c0halic

              You are only changing a specific Display of the data, not the data itself. So of course it is only changed on that one layout. The same field used on another layout is not going to display that way.

               

              If you want the data changed then two possibilities are:

              Add an Auto-Enter Calculation in Define fields to change the data to Proper case.

              Create a script to change it to proper and assign it as a Script Trigger - On Field Exit.

              • 4. Re: How can I format field to auto capitalize text?
                davidhead

                Sulrich, are you suggesting that "sentence case" would correctly change "pierre de sade" to "Pierre de Sade"? I don't think so. Capitalising names is always problematic and has to be handled with complex conditional logic.

                • 5. Re: How can I format field to auto capitalize text?

                  The "Proper ( field )" operation has the same defect as the simpler style setting. It only affects the current display of the data in the field where the setting applies. It does not change the data, so when I combine data into an ADDRESS field, the setting does not work. And, as noted, I can't apply a global style setting to the aggregated data.

                  • 6. Re: How can I format field to auto capitalize text?

                    No, I'm not suggesting that. Poor example. What I am confused/astonished by is the lack of easy settings for what I thought were standard functions (e.g., Excel, Word, Panorama) dating back years if not decades. I used FMP daily and set up many databases for my employer in the early days, up to 2002, and don't actually remember if I managed this type of setting.

                     

                    But it is very familiar with me, the Word or Sentence or ALLCAPS settings in other programs, and wonder why I can't find a simple, workable solution in FMP.

                    • 7. Re: How can I format field to auto capitalize text?

                      I don't find it working to use the Proper function, as noted. It has the same defect as the simpler style setting.

                       

                      The bug perhaps is that when you combine fields into a "megafield" , as I do with my Name and Address fields, the style setting is lost, and I don't find any way to do this.

                       

                      Gosh, I'm thinking the WANG OIS system had settings like this that worked for us 25 years ago....

                      • 8. Re: How can I format field to auto capitalize text?

                        OK, I figured out a way to do this (though it won't work with Norton de Sade!).

                         

                        I put the Proper () function in the various "calculated" fields that aggregate firstname, lastname, address, etc., and then I can control the final output by micromanaging each step in the aggregating field calculations.

                         

                        So thanks to all of you who suggested the Proper () function.

                        • 9. Re: How can I format field to auto capitalize text?

                          PS. And I put the Upper() function on the state abbreviation.

                          • 10. Re: How can I format field to auto capitalize text?
                            davidhead

                            Umm I don't think there is any 'defect' in the use of the Proper function.

                             

                            The simplest way to do this (changing the actual data in the field, not just the formatting) is to set an auto-entered calc on each field in question. Make sure that you UNCHECK the option "Do not replace existing value of field (if any)".

                             

                            To make it super easy to apply this to a lot of fields, use the Self function.

                             

                            Examples:

                            • in a field for firstName, apply the auto-entered calculation: Proper ( Self )
                            • in a field for state, apply the auto-entered calculation: Upper ( Self )

                             

                            Simple?

                            • 11. Re: How can I format field to auto capitalize text?
                              davidhead

                              You are confusing field formatting with field data entry.

                              • 12. Re: How can I format field to auto capitalize text?

                                OK, I missed the Do not replace existing value of field (if any) item. THANKS!

                                • 13. Re: How can I format field to auto capitalize text?
                                  BeatriceBeaubien

                                  Speaking of Wang...

                                   

                                  http://www.dancing-data.com/history-of-filemaker.html

                                   

                                  /end tangent

                                   

                                  On Sep 22, 2015, at 21:21, sulrich <noreply@filemaker.com> wrote

                                   

                                                            

                                  How can I format field to auto capitalize text?

                                  reply from sulrich in Discussions - View the full discussion

                                   

                                  I don't find it working to use the Proper function, as noted. It has the same defect as the simpler style setting.

                                   

                                   

                                  The bug perhaps is that when you combine fields into a "megafield" , as I do with my Name and Address fields, the style setting is lost, and I don't find any way to do this.

                                   

                                   

                                  Gosh, I'm thinking the WANG OIS system had settings like this that worked for us 25 years ago....

                                   

                                  • 14. Re: How can I format field to auto capitalize text?
                                    BrettMilne

                                    Use a calc field.

                                     

                                    TextStyleAdd ( field ; Uppercase )