1 Reply Latest reply on Sep 20, 2014 6:02 AM by philmodjunk

    Copy first line of a text field to another field

    wheymans

      Title

      Copy first line of a text field to another field

      Post

      In my database i have a field that can contain a lot of text.

      Is there a way (Calculation?) to extract the first line of this text field?

      Greetings,

      Wim

        • 1. Re: Copy first line of a text field to another field
          philmodjunk

          What marks the end of that first line of text?

          There is no easy way to identify the point at which FileMaker will break the line and "wrap" the text to the next row, But if you want all text from the start to the first return character, this is easily done:

          Set Field [YourTable::field2 ; GetValue ( YourTable::Field1 ; 1 ) ]

          It might be possible to use a special layout with a series of copies of your field all at different heights but the same width and set to slide up so that your script can a) identify the shortest copy that holds all your current text without sliding, b) remove the text one character at a time from the beginning of the text while c) changing over into preview mode and using GetLayoutObjectAttribute to check the height of the sliding field to detect when enough characters have been removed that field is able to reduce in height.