6 Replies Latest reply on Jan 11, 2017 10:06 AM by philmodjunk

    Auto adjust data in field

    neetee

      I have a limited size in form or report to display data. Suppose text field can display only 12 alphabets but user entered 15 or 20 characters. Is it possible to adjust the and display, means decrease the font size or shrink it.

        • 1. Re: Auto adjust data in field
          bigtom

          You can do this with conditional formatting.

           

          Length(Self) > 12

          • 2. Re: Auto adjust data in field
            bigtom

            If you have multiple conditions such as >12 >15 and >20 make sure to lead with >20 first as I recall these evaluate in order of the list.

            • 3. Re: Auto adjust data in field
              jbante

              I would say keep the conditions in ascending order. Conditional formatting calculations evaluate in order, but they all still evaluate and apply, and any formatting applied by later conditions overrides formatting from earlier conditions. Since >20 would probably have the most severe formatting (smallest type size), that should go last.

              • 4. Re: Auto adjust data in field
                philmodjunk

                This is a crude fix at best. Unless your field is formatted to use a mono-spaced font, the number of characters doesn't really tell you if the text will "fit" or not in the field.

                 

                There is a rather bizarre kludge that you can script that will--at least in FileMaker Pro--never tried it in Go, exactly determine whether text of any font and style does or does not fit in a given field. It uses GetLayoutObjectAttribute to check the height of the field while the cursor is in the field. If the text doesn't fit, the field expands to show the additional text and that's what your script uses this function to detect in order to tell if it "fit" or not.

                • 5. Re: Auto adjust data in field
                  siplus

                  Another crude fix is to define the tooltip of the field as "self" - moving the arrow on it will show the whole text as tooltip. And before you tell me that tooltips are too slow, read here on how to make them appear faster.

                  • 6. Re: Auto adjust data in field
                    philmodjunk

                    A tool tip is a viable option, as long as the text is a fairly small amount and you are viewing the layout in browse mode and aren't trying to generate a printed report. They are also not an option in FileMaker Go. If you have to squeeze whole paragraphs of info into the field on occasion, tool tips may disappear on you before you finish reading and the font size adjustment won't be able to make the text small enough.

                     

                    In such more extreme cases (or in GO), you can use a Popover to interactively show the contents of the field.

                    For printing/previewing, you may instead need to make the field many rows tall and use "sliding" to shrink the field to fit.