10 Replies Latest reply on Sep 19, 2011 11:25 AM by philmodjunk

    Can you re-order text within a single field??

    FMNewbie

      Title

      Can you re-order text within a single field??

      Post

      Hi folks.

      I'm looking to make a script that will re-order lines within a single text field based on a time entry at the beginning of each line.  For example:

      07:00 - got out of bed ¶

      07:10 - had a shower ¶

      07:05 - brushed teeth ¶

      ..which the script would re-write as:

      07:00 - got out of bed ¶

      07:05 - brushed teeth ¶

      07:10 - had a shower ¶

      Maybe I'm pushing my luck but I'm wondering if there's a way to do it using the ¶ character as a deliniation of some kind?  Any thoughts?

        • 1. Re: Can you re-order text within a single field??
          philmodjunk

          You can use Getvalue and several similar functions to access specific values in a list where the values are separated by returns like this, but you would be much better off to put each of those lines into a table with the time in a field of type time and a text field for the activity. Then filemaker can sort these items for you without you having to write a script for this. (And a scripted sort will be much slower than letting Filemaker sort records for you.)

          • 2. Re: Can you re-order text within a single field??
            FMNewbie

            Thanks Phil...

            So, you mean have the text and time entries exist as fields in a completely separate table within the database?  I thought of that but steered away from it because eventually I have to print these out as a sort of activity log and the text entries could be anywhere from one word to several lines long, and I'm not sure if you can auto-resize the feild heights in a "report" layout... or is there a smarter way to do that?? 

            • 3. Re: Can you re-order text within a single field??
              philmodjunk

              You can set up such a report layout with out any major trouble. You can make the text field several text rows taller than you'll ever reasonably expect to need and then set them to "slide up", "resize enclosing part". These are settings you can choose for selected objects on the inspector's position tab.

              You can use a different layout with a portal for recording these entries and switch to this layout for printing out the report (or saving it as a PDF). This report layout should be based on this separate table and thus avoid using a portal to display them.

              Key facts about sliding layout objects:

              1. It's only visible in preview mode and when you print/save as PDF...
              2. All layout objects below and in the same layout part as the slide/resize field need to also be set to slide up and resize.
              3. Objects in headers and footers will not slide.
              4. Portals will shrink/slide to fit the number of rows of records, but fields within the portal row will not shrink/slide.
              5. Consistent side borders are difficult to achieve with sliding fields.
              • 4. Re: Can you re-order text within a single field??
                FMNewbie

                Thanks Phil...

                I'm fiddling with it now, but the fields aren't re-sizing.  I have "slide up", "resize enclosing part" checked but it's not working.  Am I missing something??

                • 5. Re: Can you re-order text within a single field??
                  LaRetta_1

                  Somewhere in that body, you have an object which is NOT set to slide.  YOu will need to find it because it stops everything below it from sliding as well.

                  • 6. Re: Can you re-order text within a single field??
                    philmodjunk

                    It's a very persnickety process sometimes. The layout object that isn't set to slide (even graphic objects need to be set to slide up, not just the fields) may be next to the field that is sliding instead of "below' it. You may have field that overlaps another by one pixel...

                    Just this morning, I was baffled as to why a block of layout text wouldn't slide up and disappear until I noticed that conditional formatting was setting the font size to 500 to hide the commas that were separating the merge fields if those fields are empty. Embarassed

                    • 7. Re: Can you re-order text within a single field??
                      FMNewbie

                      Hmmmm.....  I'm still not having any luck.  I even tried creating a new blank Report layout with just one text field in it (no other objects, no labels, no graphics... just one text field in the Body) and it's still not resizing either the text box or the body no matter what combination I try.

                      Just to clarify, I want to select "Slide Up Based On: All Objects Above" and "Auto-Resize Enclosing Part."  Yes?   And do I make the text field as large as it could possibly be or just the Body size?

                      Is there something else I'm missing?  Does the field type make a difference?  Some option I need to select? 

                      Sorry if I'm not catching on to something basic.  Seems like I should be so simple.

                      • 8. Re: Can you re-order text within a single field??
                        philmodjunk

                        When you check to see if the field is sliding, are you in browse mode or preview mode?

                        Sliding is not visible in Browse mode.

                        • 9. Re: Can you re-order text within a single field??
                          FMNewbie

                          AAAAAHHHHHHH!!!!!!  That was EXACTLY the problem!!  As usual you've saved me from pulling out what little hair remains.  Thanks Phil!! Laughing

                          • 10. Re: Can you re-order text within a single field??
                            philmodjunk

                            Those of thus with follical challenges have to stick together. Wink