5 Replies Latest reply on Sep 1, 2010 2:15 PM by philmodjunk

    Finding carriage returns - is this possible?

    mattb

      Title

      Finding carriage returns - is this possible?

      Post

      Background:  I'm writing an FMP app in Mac OSX which involves transferred data from a Windows Visual Foxpro program. The FMP file import (from dBase file) routine had a bug in it where it chopped off the first letter of each paragraph contained in a VFP memo field.  This was unacceptable so I used an alternate method of importing the data using ODBC.  This worked fine (more or less) in that it did not chop off the first letter of each paragraph (hence no lost data), but what it did do is insert extra carriage returns in between each paragraph.  I would now like to remove these extra carriage returns from my FMP files.

      I tried using the FMP Find function to locate carriage returns by typing Option-7 which displays the paragraph symbol, which I understand is the symbol for a carriage return-line feed (0D 0A) in FMP.  However the Find function doesn't seem to recognize this as a valid Find criteria!

      I need to find some automated way of getting these excess carriage returns out of the fields, as it would be way too time-consuming to go record-by-record and manually delete them.  Any ideas??

      Matt Bloomfield

        • 1. Re: Finding carriage returns - is this possible?
          philmodjunk

          Make a back up copy of your file first, then use Replace Field contents and a calculated expression similar to this:

          Substitute ( TextfieldwReturns ; "¶¶" ; "¶" )

          That will turn double returns into single returns.

          Note: Replace Field Contents will modify all the records in your found set, the back up copy lets you toss your file and go with the back up copy if you make a mistake and discover the operation changed fields in ways that don't work for you.

          • 2. Re: Finding carriage returns - is this possible?
            mattb

            Phil:

            For some reason, FMP doesn't seem to understand the "¶" symbol in finds or replaces, at least not for me.

            Happily, I did stumble on the solution for my specific situation which was:

            substitute(table::field; char(13) & char(10) & char(13) & char(10); char(13) & char(10) )

            So thanks for pointing me in the right direction!

            Matt Bloomfield

            • 3. Re: Finding carriage returns - is this possible?
              philmodjunk

              FMP does indeed understand the ¶ symbol in the substitute function. I've used it that way any number of times.

              However, your example shows you have two different characters, Return and Enter in combination. ¶ just stands for the Return character, I believe.

              • 4. Re: Finding carriage returns - is this possible?
                mattb

                FMP does indeed understand the ¶ symbol in the substitute function. I've used it that way any number of times.

                However, your example shows you have two different characters, Return and Enter in combination. ¶ just stands for the Return character, I believe.

                -----------------------------------------------------------------------------------------------------------------------------------------------------------

                Phil:

                Actually those are the ASCII code equivalents of "Carriage Return" and "Line Feed" as I understand it.  So...does FMP have a usable symbol for char(10) "line feed" that I can use with the subsitute function?  Not that it matters, because the other method worked, but I'd be curious know if one exists...

                Matt B.

                • 5. Re: Finding carriage returns - is this possible?
                  philmodjunk

                  Yep I recognized the codes. The return character has a lot of uses in filemaker expressions so we have a symbol for it: ¶. The line feed is lot less common so you have to use the Char function instead.

                  You probably know this already, but to find a list of useful character codes, look up the Code function in FileMaker help.