3 Replies Latest reply on May 13, 2014 1:58 PM by philmodjunk

    Converting Multiple Records to a .txt file

    SteveMartino

      Title

      Converting Multiple Records to a .txt file

      Post

            

           Hello Forum, and as always Phil.  I'm trying to take a set of found records and change them into a properly formatted text file, so I can load this file on a SD card, and use it on a proprietary on-board computer for a delivery truck (ASCII).

           The data needs to be padded out 512 bytes per line. 

           The first line of the text file must be a blank record with specific formatting--so I made that a global field & on the layout put it in the header.

           The next multiple lines are the customer records--so I made a calculation field that concatenates all the info, properly padded to 512 bytes--so I made that a calculation field and put it into the body part of the layout.

           After that, the file must be appended with 1000 blank records, and 1000 load records.  I made each a global text field and put them in the footer field.  It looks fine in list view.

           So I think my problem lies in the layout because when I export this I get the following:

           --Header

               Record

               Footer

           --Header

               Record

               Footer

           etc., etc., 

           What I need is:

           ---Header

               All the records in the found set

               Footer.

           I tried to put all the text into the record field (which is a calculation) but hit my limit of 3000

            

           If you need anymore info, I will be happy to comply.  Any thoughts or help would be greatly appreciated.

           Thanks

           Steve

            

            

        • 1. Re: Converting Multiple Records to a .txt file
          philmodjunk

               The design of the layout doesn't really have much to do with the text file that you get. Each row of exported text represents one record in the table from which you are exporting so it looks like you need to set this up with many individual records where you currently have a great many fields.

          • 2. Re: Converting Multiple Records to a .txt file
            SteveMartino

                 Thanks for your reply as always Phil.  I did end up just using one field, and concatenating all the records with a looping script.  Unfortunately I need to export this to a .txt, not csv.  Any way I tried to export it would not allow it to work.  It kept putting an odd symbol at the end of each line, which I assume is the carriage return/line feed characters.  I also tried export field contents, which exports the field without the CR/LF characters, which also didn't work.  If I tried to put the characters in, before I export field contents, it still doesn't work.  Very fickle old technology I guess.

                 The only thing that did work was in my script, at the end, Select All, then copy.  Then I manually open the proper file and Paste.

                 Thanks again for your help.

                 Steve

            • 3. Re: Converting Multiple Records to a .txt file
              philmodjunk

                   When you use Export Field Contents, some character substitution takes place as regards to the character serving as return between lines of text. You should, however, be able to use export Records to export this data and not get that change in record separating characters.