6 Replies Latest reply on Nov 3, 2016 10:16 PM by rouelf

    Exporting a string of data as tab delimited file

    Shoreline

      Hi,

       

      I need to export my data to look like the attached example.

      What would be the easiest way of achieving this?

       

      Currently the data was being exported as comma separated. I was combining my data into one field and creating records for the header, body and footer with different information in the different lines. But now the data need to be exported with tabs in between in stead of commas.

       

      How do i do this?

        • 1. Re: Exporting a string of data as tab delimited file
          Johan Hedman

          You just change to export data in Excel format instead of comma/tab separated and you will have a Excel document directly.

          Skärmavbild 2016-11-03 kl. 11.29.23.png

          • 2. Re: Exporting a string of data as tab delimited file
            rouelf

            If your data is in one field, then perhaps substitute the commas with  tabs (Chr (9):

             

            Set Field [ YourField ; Substitute ( YourField ; “,” ; Chr (9) )

             

            Exporting field content with the script step “Export Filed Content” ?

             

            In FM Go, using the script step “Export Filed Content”, can only be saved with “.txt” extension. I can then use "Insert File" to a container, then "Export Field Content" to the TemporaryPath Folder or DocumentPath folder with appropriate path. Then "Import from URL" with appropriate path for OS X and iOS, and Windows to a text field. Then this field can be parse for csv data or what separator is being used.

             

            From FM GO, If you export the file from the Export Field Content script step to a desktop to open with a spreadsheet, then you will have to open the exported file with a text editor, like TextWrangler (OS X), or NotPad ++ (Windows) and save formatted as Unicode (UTF-8). Because the Export Field Content saves files formatted as Unicode (UTF-16) Little Endian, and in this format the comma may not be properly interpreted by spreadsheets.

            1 of 1 people found this helpful
            • 3. Re: Exporting a string of data as tab delimited file
              user19752

              Need changing separator to Char(9) from "," when combining. After combined you can't substitute only "," used as separator, "," in data also will be substituted.

              • 4. Re: Exporting a string of data as tab delimited file
                rouelf

                user19752, have read your comment several times, cant figure out what your are trying to say / do.

                • 5. Re: Exporting a string of data as tab delimited file
                  user19752

                  If the combined csv is

                  "I have comma in data, do you understand?","2nd field here"

                  Substitute "," to Char(9) makes it

                  "I have comma in data      do you understand?"     "2nd field here"

                  comma in data is now tab.

                  • 6. Re: Exporting a string of data as tab delimited file
                    rouelf

                    I See,

                    OK, I used a field for the SearchString, and a field for the ReplaceString, if you want to only change the comma in quotation marks, place “,” (quotation marks with comma inside) in the SearchString field. Then:

                     

                    Set Field [ Table::YourField ; Substitute ( Table::YourField ; Table::SearchString ; Chr(9) ) ]

                     

                    Or:  Set Field [ Table::YourField ; Substitute ( Table::YourField ; Table::SearchString ; Table::ReplaceString ) ]

                    Note in OS X: hold down option key and press tab key, this will insert a tab in the ReplaceString field.

                     

                    Results in replacing the comma in quotation marks only.