Skip to main content
Question

How can I export directly to a txt file?

  • October 19, 2017
  • 0 replies
  • 174 views

I have a report that is formatted with line breaks and I need to export it to a txt file. I can not use a csv or tsv because it wraps each record in quotes. How can I export directly to a txt file?
This topic has been closed for replies.

  • Registered
  • October 19, 2017
QuickBase correctly formats and exports CSV and TSV files and they are text files. Take a look at the output from this URL referencing four records in the Formula Function Reference table:
h t t p s://login.quickbase.com/db/6ewwzuuj?a=q&query={3.EX.16}OR{3.EX.17}OR{3.EX.18}OR{3.EX.19}&clist=3.4.10&opts=csv

Records 17 and 16 contain multi-line text in the [Examples] Field which is correctly formatted.

More than likely whatever downsteam system you are feeding this into is not being used properly. I would investigate that as the source of your problem.

  • Author
  • Registered
  • October 19, 2017
Thank you. Yes that is true for multiline but not if there are manual line breaks which have been added into the field. It add quotes to keep it one record.

  • Author
  • Registered
  • October 19, 2017
Yes which is why I need to export direct to a Unicode 8 txt file. This is what my initial report looks like.
When I export to csv and open in Notepad I get :
I cannot have the quotes in my file. I can remove it manually with a find and replace but I shouldn't have to.

  • Registered
  • October 19, 2017
You have to get down into the dirt to debug this problem. I entered your sample data into an application and ran a script against it to spit out each character and its decimal ASCII code:



First of all, I am not sure I have exactly the same field input as shown in your diagram as there almost appears to be extra whitespace at the bottom of each of your [Contact] fields:




But the second observation is probably the source of you problem. If you output CSV QuickBase is going to throw double quotes into the output where it thinks they are needed (and it does this correctly). In particular it will throw quotes around field values that have a new line within them. In contrast, if you use the API_Do_Query method you can get precise control of what is outputted as you can inspect every single character.

What I am seeing is new line character (\n or decimal 10) both in the middle and at the end of every line. The input to your downstream probably just needs to remove these newlines and concatenating all the fields into a line of CSV. I am pretty sure this would solve the problem. So the bottom line is that you just need a custom exporter script given how data has landed in your application. Or you could take steps to remove the extra newlines when the data in entered or imported in the first place.

But to be honest it is difficult to tell as I don't recognize what format your downstream process is in. What are you feeding the exported data to?

In any event it is trivial to create custom export scripts that export your data in unique ways._

  • Author
  • Registered
  • October 19, 2017
Yes I understand that it is doing what it is supposed to which is why I need a direct export to txt. The file format is a gft or gift format which is required by some eLearning programs. The extra new lines are required.