Hi Thomas,

You can write to a file by using the %File library class as follows:

        set tTempFile=##class(%FileCharacterStream).%New()
        set tTempFile.Filename=filename
        set tSC=tTempFile.CopyFrom(tStream)
        set returnValue=tTempFile.%Save()
 

You will be able to get the file name that was read in the service from the Ens.StreamContainer. It has a property called OriginalFilename that has the absolute filename saved. If the business service managed to pick up the type of file that it processed it will be populated in the Type property.

Hi Daniel,

Try instantiating the object with the filename as parameter. The filename property is just there for Cache to set and use, as far as I'm aware.

If the goal is just to write to a file try this:

set file=##class(%File).%New(filename)

do file.Open("WSN")

do file.WriteLine("Writing this to a file")

do file.Close()

You can look up the %File in the docs for usage on the open parameter

Hi Thembalani,

The property SegCount will only show you on the message level how many "lines" the message has. Ex (MSH,PID,PV1) = 3

If you want the individual pieces in the message you will have to first get to the segment correctly, this is dependent on the version of HL7 you're using. My exampe is from 2.6

>w o.GetValueAt("PIDgrpgrp(1).PIDgrp.PID:PatientIdentifierList()")
6107145310089^^^^NNZAF
 

You can then piece it out on "^"

>w $L(o.GetValueAt("PIDgrpgrp(1).PIDgrp.PID:PatientIdentifierList()"),"^")
5
 

Hope this helps

Thank you Benjamin, I'm using my own class for the hooks but I'm extending %Studio.SourceControl.ISC.cls.

I'm overriding some of the methods (GetStatus for instance) I noticed that if I add a new class to source control, check it in and then open it again I can't check it out again. It only gives me check in or undo options. After I check it in, %Studio.SourceControl.Change still shows it as Committed=0 but even if I manually change it to committed it still doesn't show the check out option. 

I have set up the shared workspaces so it should pick it up as a multi-developer instance, that's the criteria as far as I can see in the code.