Ens.DataTransform
Hi ,
I am Converting HL7 message into SDA3 format by using Ens.DataTransform Class but transformation is not happening while using this class and throwing the below error
ERROR <Ens>ErrException: <UNDEFINED>zTransform+1^Hosiptal.SDA3.DataTrans.1 *target -- logged as '-' number - @' Set target.Patient.Name=source.GetValueAt("PID:5")'
Let me know if any mistake please refer the below code
Class Hosiptal.SDA3.DataTrans Extends Ens.DataTransform
{
ClassMethod Transform(source As EnsLib.HL7.Message, target As HS.SDA3.Container) As %Status
{
Set target.Patient.Name=source.GetValueAt("PID:5")
Set target.Patient.BirthGender=source.GetValueAt("PID:8")
Set $ZT="Trap",tSC=$$$OK
do {
$$$ASSERT(0) // Subclass Responsibility
Set tSC = $$$EnsError($$$EnsErrNotImplemented,$$$CurrentClass,$$$CurrentMethod)
} while (0)
Exit
Quit tSC
Trap
Set $ZT="",tSC=$$$EnsSystemError
Goto Exit
}}
Thanks,
Smythee
Comments
You need to create HS.SDA3.Container object in Transform method before using it. Something like this:
Class Hosiptal.SDA3.DataTrans Extends Ens.DataTransform
{
ClassMethod Transform(source As EnsLib.HL7.Message, ByRef target As HS.SDA3.Container, aux) As%Status
{
#Dim sc As%Status = $$$OKSet sc = ##class(HS.Gateway.HL7.HL7ToSDA3).GetSDA(source, .xml)
Quit:$$$ISERR(sc) sc
Set target = ##class(HS.SDA3.Container).%New()
Set sc = target.InitializeXMLParse(.xml)
Quit sc
}
}Can you please give me an example so that i can learn from the example?
Code block in my answer is exactly that. What error are you getting with it?
I am getting ERROR <Ens>ErrNotImplemented: Method Hosiptal.SDA3.DataTrans.Transform() not implemented error
Please find the method i am using
ClassMethod Transform(source As EnsLib.HL7.Message, ByRef target As HS.SDA3.Container) As %Status
{
Set sc= ##class(HS.Gateway.HL7.HL7ToSDA3).GetSDA(source, .xml)
Set target=##class(HS.SDA3.Container).%New()
Do target.InitializeXMLParse(.xml)
Set target.Patient.Name=source.GetValueAt("PID:5")
Set target.Patient.BirthGender=source.GetValueAt("PID:8")
Set $ZT="Trap",tSC=$$$OK
do {
$$$ASSERT(0) // Subclass Responsibility
Set tSC = $$$EnsError($$$EnsErrNotImplemented,$$$CurrentClass,$$$CurrentMethod)
} while (0)
Exit
Quit tSC
Trap
Set $ZT="",tSC=$$$EnsSystemError
Goto Exit
}}
Yes, well, you explicitly set your error in:
do {
$$$ASSERT(0) // Subclass ResponsibilitySet tSC = $$$EnsError($$$EnsErrNotImplemented,$$$CurrentClass,$$$CurrentMethod)
} while (0)
Exit
Quit tSC
Trap
Set$ZT="",tSC=$$$EnsSystemErrorGoto Exit
} You need to remove that.
Also Patient info should be in SDA already, so you can remove:
Set target.Patient.Name=source.GetValueAt("PID:5")
Set target.Patient.BirthGender=source.GetValueAt("PID:8")Ok thank you
I have done the same in my studio but in custom business process i m not getting the value of transformed message
my business process looks like this
Method OnRequest(pRequest As Ens.Request, Output pResponse As Ens.Response) As %Status
{
Set tSC=##class(Hosiptal.SDA3.DataTrans).Transform(pRequest)
Set NewObj=##class(%Library.GlobalCharacterStream).%New()
Set pRequest=##class(Ens.StreamContainer).%New(NewObj)
Set tOneTarget=..TargetConfigNames
Set tSC=$$$OK $$$LOGINFO("tSC"_tSC) For iTarget=1:1:$L(..TargetConfigNames, ",") { Set tOneTarget=$ZStrip($P(..TargetConfigNames,",",iTarget),"<>W") Continue:""=tOneTarget
Set tSC1=..SendRequestAsync(tOneTarget,pRequest) Quit:$$$ISERR(tSC)
Set:$$$ISERR(tSC1) tSC=$$$ADDSC(tSC,tSC1)
}
}
Set tSC=##class(Hosiptal.SDA3.DataTrans).Transform(pRequest)
Is that a typo? Should maybe be "Hospital", not "Hosiptal".
Hi David,
It is not a typo, I have used the same name in data transform class
i am not getting the value from the data transform class or Do i need to make any changes in my Business process class,Can you suggest do i need to make any changes?
hi,
Do i need make any changes in the Business process
Hi,
Can you please explain the need of passing xml value into HS.Gateway.HL7.HL7ToSDA3 class
ClassMethod Transform(source As EnsLib.HL7.Message, ByRef target As HS.SDA3.Container, aux) As %Status {
#Dim sc As %Status = $$$OK
Set sc = ##class(HS.Gateway.HL7.HL7ToSDA3).GetSDA(source, .xml) Quit:$$$ISERR(sc) sc
Set target = ##class(HS.SDA3.Container).%New()
Set sc = target.InitializeXMLParse(.xml)
Quit sc
Thank you,
Smythee
}
GetSDA method accepts HL7 source in source variable and returns SDA stream in xml variable.
Thank you can i convert the output from GetSDA method into stream output
because my business operation will only accepts stream as input?
xml from GetSDA is a stream.
i am getting below swizzle object error
ERROR <Ens>ErrException: <METHOD DOES NOT EXIST>zNewRequestMessage+4^Ens.MessageHeader.1 *%GetSwizzleObject,HS.SDA3.Container -- logged as '-' number - @' Set:(''tSC) tSC=pMessageBody.%GetSwizzleObject(0,.tOID)
HS.SDA3.Container is a registered, not persistent object so you can't pass it between business hosts.
Pass xml stream instead.