Cannot set filename for Stream.FileCharacter object
In my routine when I call set filestream.FileName = filename, I get an error
"cn_iptcp://localhost:56773/USER/%Stream.FileBinary.1.INT" does not exist on the Server
I successfully instantiate the %Stream.FileCharacter object. 'filestream' value is '1@%Stream.FileCharacter'. But when I debug the code, the step where I try to set the file name fails.
The port number for local host looks good for my current instance. I have tried a few variations, such as using the method FileNameSet(). But this did not work either.
My routine exists in the USER namespace, as indicated in the error. I am very new to Cache and InterSystems, so I could be wrong, but I would expect that my call to instantiate the class would fail if I do not have access to the class property. Yet, the error message seems to indicate that FileBinary intermediate file does not exist in this namespace.
I believe the error references FileBinary because FileCharacter Extends FileBinary.
Do I need to add any type of 'include' to have access to %Stream.FileBinary.1.INT? The documentations and the examples I have found online do not seem to indicate that this is needed. I also tried exporting my code from the USERS namespace and importing it into a new ADMINCODE namespace but I get the same behavior.
Thank you.
EDIT:
GOAL: I want to write to a file
set myLogFile = ##class(%Stream.FileCharacter).%New()
set myLogFile.FileName = filename
Do myLogFile.Write("This is a test")
Do myLogFile.%Save()
Daniel Lee
Amazing Charts | Harris CareTracker