Just an update I have tried the following however, the MSH segment seems to be getting overwritten, any ideas why?

s tMsg = ##class(EnsLib.HL7.Message).%New()
s tMsg.DocType ="2.3.1:DFT_P03"
s tSeg = ##class(EnsLib.HL7.Segment).%New()
set tSeg.DocType="2.3.1:PID"
s tsc = tMsg.SetValueAt("abc","MSH:9")
s tsc = tSeg.SetValueAt("PID","1")
s tsc = tSeg.SetValueAt("TEST","3.1")
set tsc=tMsg.SetSegmentAt(tSeg,2)
w tMsg.OutputToString()

I have also tried set tsc=  tMsg.AppendSegment(tSeg) which seems to be overwriting the MSH segment.

Any help would be great.

Hi

Thank you for this link it seems very useful and has pointed me in the right direction.  I noticed when I exported the code it didn't seem to pick up the look up tables or the HL7 schemas? Also I was wondering if I gave the export routine a studio project path, would it be able to export the project.  Thanks so much for this as I can start thinking of ways to tweak this.

Kind Regards,

Salma

Hi 

Thank you for your reply, I am already using the gitlab hook within Studio, what I wanted to do was export all the files with the relevant folder paths which I have done so using ##class(%SYSTEM.OBJ).ExportAllClassesIndividual however, if I create a project and try to export the files from within studio I can't find an easy way of maintaining the folder structure, it just exports all the classes in to one folder.

Kind Regards,

Salma

Hi

 

This is what my business operation looks like method looks like.


Method GetResultspRequest As GOSHPackage.Messages.PPID.Request.MyRequest, Output pResponse As GOSHPackage.Messages.PPID.Response.MyResponse) As %Status
{
Set tSC = $$$OK
Set pResponse = ##class(GOSHPackage.Messages.PPID.Response.MyResponse).%New()

Try
{
Set tSC = ..Adapter.Connect()
Throw:($$$ISERR(tSC))
Set tSC = ..Adapter.SetAutoCommit(1)
Throw:($$$ISERR(tSC))
$$$LOGINFO("2")

Set tQuery = "SELECT top 3 surname, forename FROM [dbo].[tblTest]"

//set tQuery =..Adapter.Query
$$$LOGINFO("3")
Set tSC = ..Adapter.ExecuteQuery(.tResults,tQuery,)


Throw:($$$ISERR(tSC))

set snap=##class(EnsLib.SQL.Snapshot).%New()
set tSC = tResults.GetSnapshot(.snap)
set pResponse.TestRS =snap
Throw:($$$ISERR(tSC))
$$$LOGINFO("5")
}
Catch tException
{
Set tSC = ##class(%SYSTEM.Status).Error(tException.AsStatus,tException.Name_" Threw an Error "_tException.DisplayString)
}                                                                          
Quit tSC
}

This populates the snapshot however when I am trying to get the response back in to the BPL I get the following error

 

ERROR <Ens>ErrBPTerminated: Terminating BP PPID Shadow Processor # due to error: ERROR <Ens>ErrException: <INVALID OREF>zOnResponse1+2^GOSHPackage.Process.PPID.PPIDShadowProcess.Context.1 -- logged as '-' number - @' Set status=1,context.TestRS=callresponse.TestRS' > ERROR <Ens>ErrException: <INVALID OREF>zOnResponse1+2^GOSHPackage.Process.PPID.PPIDShadowProcess.Context.1 -- logged as '-' number - @' Set status=1,context.TestRS=callresponse.TestRS'

 

I am unsure whether this is the right approach, any help would be appreciated.

 

Thank you.

 

Salma

Hi Both,

Thank you for the suggestions, the fundamental requirement is that the PDF file needs to reach the target folder before the xml.  Also these files come in pairs so before processing it is important to check that the matching xml actually exists.  What I ended up doing was once the check was complete move the xml file in to a secondary folder which was getting polled by another business service, the xml would only reach the secondary folder once the PDF had been processed and archived this resolved the issue but again I am not sure whether it was the right solution.

I will give your suggestion a go too.  Thanks again for your help.

Kind Regards,

Salma