1

I like to understand how you can set Ens.StreamConainer to a string value. I just see a class for setting the OriginalFilename but nothing for setting the body.

s pRequest = ##class(Ens.StreamContainer).%New()
s pRequest.OriginalFilename = "Test"
d pRequest.Stream.Read(hl7) //Error Out
d pRequest.StreamSet(hl7) //Getting empty string 
Jefferson
  • 173
  • 2
  • 12
  • 32

1 Answers1

1

If hl7 is a stream:

s pRequest = ##class(Ens.StreamContainer).%New(hl7)

It hl7 is a string:

s pStream = ##class(%Stream.GlobalCharacter).%New()
do pStream.Write(hl7)
s pRequest = ##class(Ens.StreamContainer).%New(pStream)

Some code advice:

d pRequest.Stream.Read(hl7) //Error Out

Read reads from stream, and Write writes to stream.

d pRequest.StreamSet(hl7) //Getting empty string

It is a setter method for Stream property. There's no need to call it directly, just set the property.

rfg
  • 1,331
  • 1
  • 8
  • 24