Jump to content

csv output and formatting a combination field so it has spaces


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

Recommended Posts

I am trying to export a selection of records. I export them into a csv file. One of the fields is made up of several other concatenated together.

 

e.g.

 

field1  & " " & TextStyleAdd ( field2; Bold ) &  Case( IsEmpty(field2); "";  "")  & "¶"  & TextStyleAdd(field3;SmallCaps) & "¶" & field4  & "¶" & TextStyleAdd ( field5; Italic ) &  Case( IsEmpty(field5); "";  " ") & " "   &  Case( IsEmpty(field5); "";  "¶¶")  & field6 &  Case( IsEmpty(field6); "";  "¶") & Score_100 &   Case( IsEmpty( field7) ; " "; TextStyleAdd ( "/ "; Subscript ))   & " " & Year( Date) & Case( IsEmpty(Date); ""; TextStyleAdd ( "  [Date]"; Superscript )) &  Case ( 0 ; ( field8 ) * 100 & "%" )  &  Case( IsEmpty(field8); "";  "¶")  & GetAsText ( field9 )  & Case( IsEmpty(field9); "";  "¶")  & Case ( 0 ; ( Alcohol ) * 100 & "%¶" )  & Region::Appellation&Case( IsEmpty(Region::Appellation); "";  "¶") & Region::Region&Case( IsEmpty(field1a); "";  "¶")  & field1b&Case( IsEmpty(Region::field1b); "";  "¶")  & field1c&Case( IsEmpty(field1c); "";  "")

 

The field looks fine in FM (8.5 by the way), but when I EXPORT this to a csv file most of the contents of this run together and don't retain the formatting of the paragraphing as shown above. On the other hand if I 'SAVE AS' and choose Excel it seems better and then I convert into a csv using say OpenOffice.

 

What can I do to keep the formatting to export to a csv - I click the retain formatting link ? Thanks.

 

Link to comment
Share on other sites

when I EXPORT this to a csv file most of the contents of this run together

 

When you export as .csv, carriage returns in a field are exported as vertical tab characters (ASCII 11). This can be avoided by exporting as XML and using a custom XSLT stylesheet to transform the output to csv. Or post-process the file in a third-party app, replacing the vertical tabs by CR and/or LF characters.

Link to comment
Share on other sites

This topic is 3359 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.