1 2 Previous Next 16 Replies Latest reply on Jul 10, 2015 1:59 PM by user9259

    Line up text in value list

    user9259

      I have a script that creates a value list of events. How would you line these fields up into columns? I am using to send an email.

      I have tried padding fileds in calculation with spaces and using Courier & Courier New which are mono spaced and no luck..

      TextFont(Left(Date&"               ";15) ;"Courier New") &

      TextFont(Left(Event # &"                  ";20) ;"Courier New")

       

       

      Like this:

      7/1/2015           Event 1          Baseball Game

      7/10/2015          Event 2          Basketball Game

      12/20/2015         Event 3          Soccer Game

       

      not like this:

      7/1/2015           Event 1          Baseball Game

      7/10/2015          Event 2          Basketball Game

      12/20/2015         Event 3          Soccer Game


      Thank You!

        • 1. Re: Line up text in value list
          keywords

          Using spaces and monospace fonts is a waste of time, for the obvious reason, as shown by your example, that the dats are of varying length. You need tabs for this purpose.

          1.     Change your calc to something like: DateField & <insert a tab using either Char(9) or option+tab> & EventNoField & EventNameField

          2.     Set up the field instance on your layout with tabs at the appropriate places to display you data correctly


          Note that this is a two-part solution to this issue, (1) putting a tab into the text to be displayed, and (2) setting up the layout to display the data the way you want.

          • 2. Re: Line up text in value list
            user9259

            Thank You...i do not want in a layout but rather as a calculation that will be placed in an email. I have tried tabs in a calculation with Char(9) with similar results.

            • 3. Re: Line up text in value list
              beverly

              well and good Key, but would these translate in the email? I've never been able to make a "table" without the mono-spaced & padding. Or without the use of plug-in to send 'html' email. And HTML table? sure easy, but requires more than native email to send.

               

              That or make 'report' with PDF and attach (which also works natively.

              On Jul 9, 2015, at 6:56 PM, keywords <noreply@filemaker.com> wrote

              • 4. Re: Line up text in value list
                user9259

                what is wrong with my mono spacing? am i using correct font? Can I do this within a calculation?

                • 5. Re: Line up text in value list
                  keywords

                  Fair point, and, no probably not. The safest way any time you want to control a layout's appearance in any context is to use PDF—that is the very purpose for which Portable Document Format was developed.

                  • 6. Re: Line up text in value list
                    beverly

                    I do create these padded columns & mono-spaced font!

                    It's just hefty calculating.

                     

                    -- sent from myPhone --

                    Beverly Voth

                    --

                    • 7. Re: Line up text in value list
                      user9259

                      yes I am looking for guidance other than just a pdf

                      • 8. Re: Line up text in value list
                        beverly

                        Ok, here's an article about "padding text" that I wrote. See if it helps. There are custom functions (other than mine) that may help, too.

                         

                        Fixed Width for EDI and Other Reporting | FileMakerHacks

                         

                        There is an example file that should be able to open in fm (version for .fp7, but can be converted for use with .fmp12

                         

                        beverly

                        • 9. Re: Line up text in value list
                          keywords

                          Here is a calc that adds variable padding to two columns; you should be able to adapt the technique for further columns:

                           

                          Let ( [

                            text = "first field" // put four first field here instead of my sample text

                          ; extra = "second field here" // ditto for second field

                          ; space = "                              " // the number of spaces needed is the total from start of first column to start of second column

                          ; lenText = Length ( text ) // 11

                          ; lenExtra = Length ( extra ) // 17

                          ; lenSpace = Length ( space ) // 30

                          ; textPlus = text & Left ( space ; lenSpace - lenText )

                          ; extraPlus = extra & Left ( space ; lenSpace - lenExtra )

                          ; result = textPlus & extra & "¶" & extraPlus & text

                          ] ;

                          TextFont ( result ; "Courier" )

                          )

                          • 10. Re: Line up text in value list
                            rrrichie

                            If the dates are always in the format you have in the example just add a little padding after the date like so

                             

                            TextFont(Left(Date&"               ";15 + (10 - Length ( Date ) )  ) ;"Courier New") &

                            TextFont(Left(Event # &"                  ";20) ;"Courier New")



                            Which should add 2 or 1 space after the date.


                            Happy Coding!

                            • 11. Re: Line up text in value list
                              okramis

                              TextFont(Left(Date&"               ";15) ;"Courier New") &

                              TextFont(Left(Event # &"                  ";20) ;"Courier New")

                              The problem might be, that filemaker hands just plain text over to the email application, so your TextFont() has no impact on the appearance in the mail, the plain text font is user setting dependent and most probably not set to a mono spaced font.

                               

                              Regards

                              Otmar

                              • 12. Re: Line up text in value list
                                beverly

                                Otmar is correct. The user's email client will take the text as it comes in and personal setting may think it's HTML or another font. However, pushing space-padded text still can be read. Just include a line "best viewed in mono-spaced font".

                                • 13. Re: Line up text in value list
                                  rrrichie

                                  I've used Applescript in the past to send the text to mail and format it with a mono-space font.

                                   

                                  Haven't played around with it for a while (use plugins now and html mail), but html would be a better option.  It's a shame we can't just push html via the send mail script... At least not last time I checked...

                                   

                                  In this case space padding might work pretty wel if the second column is always the same length... but I suspect it won't :-)

                                  • 14. Re: Line up text in value list
                                    beverly

                                    In my example, the cf gets the column length, so does not need to always be the same.

                                     

                                    -- sent from myPhone --

                                    Beverly Voth

                                    --

                                    1 2 Previous Next