Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 4676 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

When using any method to export text, either scripted from a field or a record set, or just right-clicking on a field, the carriage returns in the body of the field are not properly formatted. this is the case regardless of which character set i export to, windows ansi, utf-8 etc. i've had this problem before, but somehow it seems to have gotten worse, perhaps since i upgraded to version 9? i remember reading something about using xslt to fix the problem, but my knowledge of xsl is pretty non-existent

Posted

With xml/xsl returns in the text fields (which are internally ASCII #11) are translated to returns (ASCII #10, line feed, on Mac OS 10, perhaps also on Windows; it's kind of the standard; I'm too lazy to look now ;)-).

But this does not solve the basic problem of what to put in between the fields, and what between the records. If you do not specify anything, xsl will just mush it all together; probably not what you want.

In this example file I've put a single line feed between fields, and 2 between records, sort of what you'd expect with address blocks. But you could really put whatever you want; ASCII #09 (tab) between, and a single line feed at the end, or a Windows return (ASCII #13 then ASCII #10).

There are a few example outputs included, for the different possible encodings, which are specified by the 'encoding' attribute of the 'output' element.

utf-8 is pretty much a standard, compatible with most modern applications

utf-16 is better, if you have special characters, accents, etc., in your FileMaker data (which is internally utf-16)

or other older encodings

The xsl file is FM_Data.xsl (yeah, kind of a dumb name, and it's hard-coded into the export xsl file path; not flexibly done with a script Variable).

Export_1_field.zip

  • 11 months later...
  • 1 month later...
Posted

This seems to fix a carriage return problem I'm having as well... but only when I use the actual file (FM_Data.xsl) in the "Specify XML and XSL Options" window. There are two other options available: 2) HTTP request and 3) Calculation.

If I simply copy and paste the contents of FM_Data.xsl into the HTTP request field and run my script, FileMaker gives me a blank exported file and this error message:

XSLT warning: Fatal Error at (file , line 0, column 0);) An

exception occured! Type:RuntimeException,

Message:The primary document entity could not be

opened. Id=<?xml version="1.0" encoding="utf-8"?>

smlns:xsl="http://www.w3.org/1999/XSL/Transform"

(there's more but I can't resize the Windows error message)

If I must use the file, I fear that I must first import the file into a container field, export that file to the user's temp folder, and reference the file in the export options. LOTS of extra work just to get a carriage return working.

-Matt

p.s. For those interested in what I'm doing, I'm setting up a FileMaker based VNC session launching system for allowing my boss to easily view workstations on the network. For Windows, I'm using the RealVNC .vnc file protocol, and it's critical that the carriage returns exist.

  • 5 months later...
Posted (edited)

Thank you in advance...

I am trying to export records to a text file for later import into an older database. I am required to submit a file with a header record and a Trailer record. Everything is working fine, except that I have a carriage return after the header record and before the trailer record which isn't getting picked up.

I have fried using this Style sheet and the problem I am having is that this script is inserting a CR after earch record which already has a carriage return resulting in 2 CRs and a blank line after each record.

My Calculation:

Case(



Get(RecordNumber)=1;

Left(Header_Record_Type&pad_space;3)&

Left(Header_File_Description&pad_space;30)&

Right(Processing_Date;8)&

Right(pad_zero&File_Creation_Date;8)&

Right(pad_zero&Range_Start_Date;8)&

Right(pad_zero&Range_End_Date;8)&

Right(pad_space;335)&¶ & 





Right(pad_zero&Member_ID_Number;15)&

Left(Last_Name&pad_space;25)&

Left(First_Name&pad_space;25)&

Left(Address_Line_1&pad_space;35)&

Left(Address_Line_2&pad_space;35)&

Left(City&pad_space;25)&

Left(State&pad_space;2)&

Left(Address_Line_1&pad_space;35)&

Left(Zip_Code&pad_space;5)&

Left(Zip_4&pad_space;4)&

Left(DPBC&pad_space;3)&

Left(Phone_Number&pad_space;10)&

Left(Email_Address&pad_space;27)&

Left(pad_space;7)&

Left(pad_space;15)&

Right(pad_zero&Group_Number;9)&

Right(pad_zero&Effective_Date;8)&

Right(pad_zero&Expiration_Date;8)&

Left(Opt_Out&pad_space;1)&

Left(pad_space;108)



;



Get (RecordNumber)=Get(FoundCount)



;



Right(pad_zero&Member_ID_Number;15)&

Left(Last_Name&pad_space;25)&

Left(First_Name&pad_space;25)&

Left(Address_Line_1&pad_space;35)&

Left(Address_Line_2&pad_space;35)&

Left(City&pad_space;25)&

Left(State&pad_space;2)&

Left(Address_Line_1&pad_space;35)&

Left(Zip_Code&pad_space;5)&

Left(Zip_4&pad_space;4)&

Left(DPBC&pad_space;3)&

Left(Phone_Number&pad_space;10)&

Left(Email_Address&pad_space;27)&

Left(pad_space;7)&

Left(pad_space;15)&

Right(pad_zero&Group_Number;9)&

Right(pad_zero&Effective_Date;8)&

Right(pad_zero&Expiration_Date;8)&

Left(Opt_Out&pad_space;1)&

Left(pad_space;108)&

¶ &

Left(Trailer_Record_Type&pad_space;3)&

Get(FoundCount) + 2&

Left(pad_space;389)

;



Right(pad_zero&Member_ID_Number;15)&

Left(Last_Name&pad_space;25)&

Left(First_Name&pad_space;25)&

Left(Address_Line_1&pad_space;35)&

Left(Address_Line_2&pad_space;35)&

Left(City&pad_space;25)&

Left(State&pad_space;2)&

Left(Address_Line_1&pad_space;35)&

Left(Zip_Code&pad_space;5)&

Left(Zip_4&pad_space;4)&

Left(DPBC&pad_space;3)&

Left(Phone_Number&pad_space;10)&

Left(Email_Address&pad_space;27)&

Left(pad_space;7)&

Left(pad_space;15)&

Right(pad_zero&Group_Number;9)&

Right(pad_zero&Effective_Date;8)&

Right(pad_zero&Expiration_Date;8)&

Left(Opt_Out&pad_space;1)&

Left(pad_space;108)

)

Again, thank you for your help

Edited by Guest
Posted

Hi dpmnyc,

I guess I didnt click the "Show" Checkbox...

No, you probably did. However, this option is only available to the original poster. This is what happens when you try to adapt an exiting Thread, to be your own question.

If your question is on a different Platform, OS, Version, than what shows in your profile, you have to type that information into your Post.

HTH

Lee

Posted

I suspect you are experiencing the same bug as described here:

http://fmforums.com/forum/showtopic.php?tid/191976/post/305681/#305681

I believe you could bypass this issue by letting the stylesheet create the enclosing records. This is preferrable in any case: since you are using a stylesheet anyway, the entire logic of the export can and should reside there; there's no reason to burden your solution with it at all. I would have the stylesheet do everything, including the padding.

Posted

Also, from the research I have done, it seems that the stylesheets will only allow me to use ONE fixed width for all the columns, I need each column to have its own width.

Posted

from the research I have done, it seems that the stylesheets will only allow me to use ONE fixed width for all the columns

You need better research - see the attached example.

Note that this is a rather primitive method. It's not how I would actually do it, but it shows the principle.

FixedWidthPerColumn.xsl.zip

Posted (edited)

It's not so much that you could not specify the width (and padding) for each column separately. It's more that it would be tedious, and specific to a particular output. Hence no one has built an example file for it.

[P.S. I should have said, "no one yet". Thanks Comment.]

Edited by Guest
Posted

Thank you for the example...I understand it for the most part, but I have a couple questions...

"...fmp:COL[1],$trail),1,10)"

1. Where it references Col[1]...would that be the name of the Column, or does it just refeence the columns in order of the export?

2. In the example above I assume that "10" references the fixed length, but what does the "1" reference?

Thank you for your conitinued resposes!

dp

Posted

COL[1] means the first field in the order of export. The FMPXMLRESULT grammar separates field names and field contents. To understand this better, export without a stylesheet and examine the result.

The substring() function is very similar to Filemaker's Middle() function: the parameters are substring ( string, start {, length}). The "1" is the start and "10" is the length.

  • 3 years later...
Posted

... But you could really put whatever you want; ASCII #09 (tab) between, and a single line feed at the end, or a Windows return (ASCII #13 then ASCII #10).

Hi,

Many thanks for sharing this, and apologies for dragging up such an old topic.

I find myself needing to export with a CRLF at the end of each line. I am on FM11 with Mac OS10.7

In the xsl file I changed the line

<xsl:text>&#10;&#10;</xsl:text>

to

<xsl:text>&#13;&#10;</xsl:text>

which I thought would do it. However, each time the exported lines end with a single CR.

Is there something I am missing?

Many thanks,

ft.

Posted

...

In the xsl file I changed the line

<xsl:text>&#10;&#10;</xsl:text>

to

<xsl:text>&#13;&#10;</xsl:text>

which I thought would do it. However, each time the exported lines end with a single CR.

...

Please ignore this question because I've been chasing ghosts.

I have TextWrangler > Preferences > Text Files > Translate Line Breaks checked. So, each time I was opening an exported doc with CRLF, TextWrangler was stripping the LFs automatically.

This led me to believe they were not being exported, when, in fact, they were.

HTH someone.

Thanks,

ft.

This topic is 4676 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.