Hi All
There is another (hidden and undocumented) method
At the top of the class
Include %sqlmgrUtil
And then you have access to a useful macro $$parseString
I find this useful when I need to do some transforms on the csv data rather than just suck the raw data into a class
Code snippit
set oStream =##class(%Library.FileCharacterStream).%New()
set sc =oStream.LinkToFile("somefile.csv")
if sc'=$$$OK break
do oStream.Rewind()
set xDelim=",", xQuote=""""
while 'oStream.AtEnd()
set xLine=oStream.ReadLine(10000)
set xLine=$zstrip(xLine, ">wp")
set x1=$$parseString(xLine, xDelim, xQuote, .arr)
///you now have the individual cells from the csv in the array "arr"
///and you can process/transform them individually
}
Look in %sqlmgrUtil.inc for the definition
Peter
- Log in to post comments