4 Replies Latest reply on Dec 3, 2008 2:56 PM by raybaudi

    Export content of one field per record one after another to a single text file

    pjd

      Title

      Export content of one field per record one after another to a single text file

      Post

      I would like to export the contents of a text field to a text file.

       

      The contents for each record will be written one after another.

       

      I currently do this using an AppleScript to paste the contents

      of each record into a text editor.

       

      This is getting pretty slow as the number of records increase.

       

      It should be fairly straight forward to export directly to a text

      file from within FileMaker, but there does not seem to be an

      simple way to do this. All the options I have seen involve using

      commas or tabs to separate the records.

       

      I simply want FileMaker to write the contents of one field for

      each record to a text file without doing anything else.

       

      Is there a way to do this?

       

      Thanks in advance :-)

       

      - Pete 

        • 1. Re: Export content of one field per record one after another to a single text file
          TSGal

          Pete:

           

          Thank you for your post.

           

          Exporting to a comma or tab separated file means the field values are separated by either a comma or tab, and each record is separated by a return.  Since you are only exporting one field, there is no comma or tab needed to separate the fields.  Therefore, Export to a tab-separated text file, and just specify the field you want to export.  You should get the result you want.

           

          TSGal

          FileMaker, Inc. 

          • 2. Re: Export content of one field per record one after another to a single text file
            pjd
              

            This does not work since it alters the text on export, specifically it removes any carriage returns.

            In the case of csv, it add quotes. 

             

            This is a partial view of the contents of the field: (if viewed in a monospaced font these line up correctly)

             

            7163572c-a9d4-42d0-8650-a9f87dbc5b5e:

              family                   : Agelenidae

              family_concept_uuid      : 235ee9d8-e838-4eb2-a9ab-9fd4dc315bdc

              spec_concept_uuid        : 7163572c-a9d4-42d0-8650-a9f87dbc5b5e

             

            This is the yaml text format, which I need for my rails application.

             

            If I export in either tab I get this:

             

            7163572c-a9d4-42d0-8650-a9f87dbc5b5e:  family                   : Agelenidae  family_concept_uuid      : 235ee9d8-e838-4eb2-a9ab-9fd4dc315bdc  spec_concept_uuid        : 7163572c-a9d4-42d0-8650-a9f87dbc5b5e 

             

            There are probably others who would like a way to export the contents of a calculated field "as is" with no additions or changes.

             

            Thanks,

             

            - Pete 

             

            • 3. Re: Export content of one field per record one after another to a single text file
              TSGal

              pjd:

               

              Return characters in FileMaker Pro are stored as ASCII (11) instead of ASCII (13).  This allows records to be exported by keeping the information in one record instead of exporting to separate records.

               

              You have a few options...

               

              You can open the file in Microsoft Word and save it again as text.  Microsoft Word translates ASCII-11 characters to ASCII-13.

               

              You can create a new table, and write a script that puts each line into its own record in the new table.  Then, you can export to a tab-delimited field.  This can be accomplished as follows:

               

              Go to Layout [<original table layout> ]

              Enter Browse Mode []

              Go to Record/Request/Page [First]

              Loop

                 Set Variable [$string; TextField]

                 Go to Layout [<new table layout> ]

                 Set Variable [$temp; $string]

                 Loop

                    New Record 

                    If [PatternCount ($temp; "¶") > 0

                       Set Field [NewField; Left ($temp; Position ($temp; "¶"; 1; 1) - 1) ]

                       Set Variable [$temp; Right ($temp; Length ($temp) - Position ($temp; "¶"; 1; 1)) ]

                    Else

                       Set Field [NewField; $temp]

                       Set Variable [$temp; "" ] 

                    End If

                    Exit Loop If [$temp = "" ]

                 End Loop

                 Go to Layout [<original table layout> ]

                 Go to Record/Request/Page [Next; Exit after last]

              End Loop

              Go to Layout [<new table layout> ]

              Export Records

               

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

               

              If you need clarification, please let me know.

               

              TSGal

              FileMaker, Inc. 

              • 4. Re: Export content of one field per record one after another to a single text file
                raybaudi
                  

                This script is simpler...

                 

                Enter Browse Mode []
                Go to Layout [ <original table layout> ]
                Go to Record/Request/Page [ First ]
                Loop
                 Set Variable [ $string ; TextField ]
                 Go to Layout [ <new table layout> ]
                 Set Variable [ $count ; 1 ]
                 Loop
                   Exit loop If [ IsEmpty ( GetValue ( $string ; $count ) ) ]
                   New Record
                   Set Field [ newField ; GetValue ( $string ; $count )
                   Set Variable [ $count ; $count + 1 ]
                 End Loop
                 Go to Layout [ <original table layout> ]
                 Go to Record/Request/Page [ Next ; Exit after last ]
                End Loop
                Go to Layout [ <new table layout> ]
                Export Records