Published on InterSystems Developer Community (https://community.intersystems.com)

Home > SqloutBound Adapter with Output to File

Question
Thembelani Mlalazi · Mar 13, 2018

SqloutBound Adapter with Output to File

Hi guys have an operation that I would like to write the results from the results set to a csv file but have been struggling to get it to work here is my code so far and also here is the error that I get when I try to test this operation using the testing on the ensemble

error:

An error was received : ERROR <Ens>ErrException: <COMMAND>zMessageHandler+6^DQTools.DQTOpp.1 -- logged as '-' number - @' Set tSC=..CheckRequests(.pRequest,.pResponse)'
 
code:
 set file = ##class(%Stream.FileCharacter).%New()
 set fileName="C:\File\99_Testing\123.txt"
  do file.LinkToFile(fileName)
  while 'file.AtEnd {
 // set query = "SELECT * from Adminstration"
  set rs = ##class(%SQL.Statement).%ExecDirect(, query)
  set sc = rs.%DisplayFormatted(100,file)

 

 

#Ensemble #Business Operation

Source URL:https://community.intersystems.com/post/sqloutbound-adapter-output-file