1. Allan Seagrott
  2. PowerBuilder
  3. Tuesday, 24 October 2017 08:52 AM UTC

Hi

Trying to dump a datawindow out to a CSV file using PB 17.0.1681 using the saveasascii command with a comma delimiter and default quote.

On trialing this I've found that it doesn't escape an embedded quote in the string ie a " is not turned into "" 

Does anyone found a way to handle this scenario?

The reason I'm using that command is to get the datawindow format out with computed columns included rather than coding them into the SQL statement.

Thanks

Allan

 

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 24 October 2017 13:09 PM UTC
  2. PowerBuilder
  3. # 1

Hi Allan;

   Can you post the exact SaveAsAscii () command syntax that you are using?

Failing altering the command, you may have to do some parsing of the exported file.

Regards ... Chris

Comment
  1. Allan Seagrott
  2. Tuesday, 24 October 2017 20:59 PM UTC
Hi Chris



I've done a workaround by copying the datawindow and doing a find/replace on embedded quotes to turn them into "".



Not ideal but it works.



Regards



Allan

  1. Helpful
There are no comments made yet.
Allan Seagrott Accepted Answer Pending Moderation
  1. Tuesday, 24 October 2017 18:10 PM UTC
  2. PowerBuilder
  3. # 2

I've tried quite a few combinations including

li_rc = idw_requestor.saveasascii (as_filename,',')

and explicitly defining the quote

li_rc = idw_requestor.saveasascii (as_filename,',', '"')

I'm looking to dump the file as CSV so I can import it into Excel. I'm looking for it to handle the following case

indigo "foxtrot" charlie

which it currently outputs as 

"indigo "foxtrot" charlie"

Comment
There are no comments made yet.
Luiz Ribeiro Accepted Answer Pending Moderation
  1. Friday, 27 October 2017 18:56 PM UTC
  2. PowerBuilder
  3. # 3

Hi Allan.

Try to use SaveAsFormattedText insted of SaveAsAscii:

idw_requestor.SaveAsFormattedText (as_fileName, EncodingANSI!, ";", "")

Regards,

Luiz

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.