do ##class(%SQL.Statement).%ExecDirect(,"select top 10 'foo'").%DisplayFormatted("CSV",,,.filesUsed)
do ##class(%Stream.FileCharacter).%OpenId(filesUsed(1)).OutputToDevice()
I think that there is a 'DOS CSV' file format that dows use COMMAS but I am not sure how you would specify it. In Excel, it is one of the options when exporting a spreadsheet to a delimited text file.
Would be nice to add a parameter to %DisplayFormatted for specifying a separator character/string when the first parameter is "CSV". Until then, I'll go through the result set and use %Print("|") to use a non-tab, non-comma separator when exporting results with embedded commas as requested by a customer (they don't like tabs).
Hi!
Please, check out if this answer from @Eduard Lebedyuk works for you: https://community.intersystems.com/post/query-result-save-csv#comment-11...
Thanks - simple example is:
do ##class(%SQL.Statement).%ExecDirect(,"select top 10 'foo'").%DisplayFormatted("CSV",,,.filesUsed) do ##class(%Stream.FileCharacter).%OpenId(filesUsed(1)).OutputToDevice()
As it says in the Class Reference, "NOTE: pFormat of CSV/100 is not a true comma separated value, but instead uses TAB separated values."
Yeah... kind of annoying.
Hi
I think that there is a 'DOS CSV' file format that dows use COMMAS but I am not sure how you would specify it. In Excel, it is one of the options when exporting a spreadsheet to a delimited text file.
Nigel
Would be nice to add a parameter to %DisplayFormatted for specifying a separator character/string when the first parameter is "CSV". Until then, I'll go through the result set and use %Print("|") to use a non-tab, non-comma separator when exporting results with embedded commas as requested by a customer (they don't like tabs).
Using Dynamic SQL | Using InterSystems SQL | InterSystems IRIS Data Platform 2021.1