Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com)
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi
Tinderbox Users >> Exporting from Tinderbox >> CSV export with return characters intratext
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1429223885

Message started by whymany on Apr 16th, 2015, 6:38pm

Title: CSV export with return characters intratext
Post by whymany on Apr 16th, 2015, 6:38pm

I'm trying to export notes to CSV format, and I've succeeded in it thanks to the feedback given to other users, except for one thing which I've yet to figure out. How do I prevent line returns in $Text from breaking into "records" in the exported CSV?
I can't simply eliminate the line returns in $Text as I need them in the exported CSV.
I'm trying to export into FileMaker, if that makes a difference.


Title: Re: CSV export with return characters intratext
Post by Mark Bernstein on Apr 17th, 2015, 1:11pm

I believe that CSV  requires that you enclose the field that may contain newline characters in quotation marks.  That means, in turn, that the field may not contain quotation marks; if it does, those quotation marks need to be escaped (and I donít recall offhand exactly what convention CSV uses for this.)

Title: Re: CSV export with return characters intratext
Post by Juan on Apr 17th, 2015, 9:31pm

I fixed the problem!!

The problem is straight quotes vs. smart quotes. If I use smart quotes, I will get some encoding problems, so I changed the smart quotes, which all quotation marks were being converted into automatically, into straight quotes.
The escape character for quotation marks, is another quotation mark besides it.
So, if I want to convert:

"I'm going to say Kentucky will pull away."

I need to type it in as:
""I'm going to say Kentucky will pull away.""

Also, the export template looks like this:
^title^,"^text^"

moreover, I saved the item with a .csv extension.

I knew it was easy to import database stuff into TB, but I didn't know it was easy to re-export stuff into a database. Now I know. †:)

Thanks Mark for such a wonderful program!

BTW:
I found things that Mark Anderson wrote concerning quotes
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1341411495/0#0
http://www.acrobatfaq.com/atbref5/index/ActionsRules/Operators/FullOperatorList/Stringreplacepatternrepl.html

Title: Re: CSV export with return characters intratext
Post by Juan on Apr 18th, 2015, 10:58pm

I ran into a small problem where I couldn't figure out how to convert all the smart quotes in the document to straight quotes, so I thought I'd share how to do that here:

Query:
$Text.contains(".*")
Action:
$Text = $Text.replace("ď",'""')
(I enlarged the size of the smart quote so it's visible)

You have to perhaps create two agents: one agent will search for all left smart quotes, and the other all right smart quotes and replace each with straight quotes.
I don't know of a simpler way to do this, but I think it works.

Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com) » Powered by YaBB 2.2.1!
YaBB © 2000-2008. All Rights Reserved.