6 Replies Latest reply on Aug 28, 2010 9:02 AM by djk

    Export record with fixed lengh

    djk

      Title

      Export record with fixed lengh

      Post

      I have the following problem:

      I have to export the contents of a record (consisting of only one TEXT-field) which contains text, its length divisible by 128, e.g. a text which has 256 Bytes.

      I use the script-function "Export Record" into a "tab-seperated"-Text.

      I'm using MAC and OS 10.5.x

      The problem is, that filemaker adds an CR (hex 0D) at the end of to the new file.

      Now the file has a length of 257 and is not longer processible, because it's not divisible by 256 any longer.

      Does someone has an idea how to avoid the extra Byte or get rid of it?

        • 1. Re: Export record with fixed lengh
          MikhailEdoshin

          The built-in FileMaker exports are pretty much hardcoded. You can export XML and transform it into text with a XSLT stylesheet; this way you'll have much more control. Do you need some help with XSLT?

          • 2. Re: Export record with fixed lengh
            djk

            Hi Mikhail!

            Thanks for the fast answer.

            I would be glad if you can give me some help with XSLT sheets.

            I never worked with that feature.

            • 3. Re: Export record with fixed lengh
              MikhailEdoshin

              Hi Dieter,

              Here are the files. The first, export_256.xslt will take the first field in the first record and export it as is. This is best if your field is already exactly 256 character long. The second, export_256_with_padding.xslt will do the same, but will explicitly trim the field contents to 256 characters, padding smaller data with trailing spaces.

              link

              same link as plain text, if the above doesn't work: http://www.mediafire.com/?e58ap3soprj4l

              To use them, export your data as XML and in the export dialog select the appropriate XSLT stylesheet.

              • 4. Re: Export record with fixed lengh
                djk

                Hi Mikhail!

                Thanks for your help. The scripts work fine :-)

                I only added <encoding="ISO-8859-1"> to get the right umlaut.

                This works fine for Windows (XP), but do you know which parameter I need for an Intel-MAC (OS 10.5.8)?

                E.g.: when I send the Data directly to a file using the Filemaker-Export-function mentioned above, I'll get a file which I can open with the Program "Textedit" and the umlaut is fine. If you look at the binary-file, you see that e.g. the a-umlaut is code 80 (hex).

                After using your script (export_256.xslt) and encoding to ISO-8859-1 >>> the a-umlaut for example is coded C4(hex) which is fine for windows, but wrong for my MAC.

                Any idea?

                I tried to learn it by myself, but so far had no luck :-(

                Can you help?

                Many thanks in advance!

                • 5. Re: Export record with fixed lengh
                  MikhailEdoshin

                  Hi Dieter,

                  Mac OS X uses Mac Roman; in XSLT this will be <encoding="macintosh">. But then this file won't open correctly under Windows. So you'd have to have two files, I guess. In Mac OS X Text Edit one can manually specify encoding when opening a file, but this can be tedious.

                  • 6. Re: Export record with fixed lengh
                    djk

                    Hi Mikhail,

                    sometimes it's so easy.... :-)

                    You only have to have the "magic word" :-)

                    You are right - I have to use two script files.

                    But that's no problem, because I simply branch with "Get(SystemPlatform)".

                    Thank you once more for your help - now everything runs well :-)

                    CU