Generating a HealthShare Ens.Request with Proper XML Representation: Issue with Transformation
Hello,
First of all thanks for your help, and thank you for your time.
We have the following task:
To generate by hand the Ens.Request with the properties and inner Data Schemes which represent this XML, in HealthShare, by hand; the XML is this one:
<DSPortal360xmlns="http://tempuri.org/DSPortal360.xsd"><Paciente><NumExpediente>6258338</NumExpediente><Informes><Fecha_Creacion>2024-07-17T11:30:05+01:00</Fecha_Creacion><Id_Visita>8177822</Id_Visita><Titulo>Visita 17/07/2024</Titulo><Desc_Tipo_Plant>99</Desc_Tipo_Plant><NumExpediente>6258338</NumExpediente></Informes></Paciente></DSPortal360>We have created in HealthShare the following classes which extends from Ens.Request to represent the mentioned XML:
Class Mensajes.Request.DragoAP.Portal360.InformeVisitaRequest Extends (Ens.Request, %XML.Adaptor) [ ProcedureBlock ]
{
Property Paciente As EsquemasDatos.DragoAP.Portal360.Paciente;
}
Class EsquemasDatos.DragoAP.Portal360.Paciente Extends (%Persistent, %XML.Adaptor) [ ProcedureBlock ]
{
Property NumExpediente As%String(MAXLEN = "");Property Informes As list Of EsquemasDatos.DragoAP.Portal360.Informes(XMLNAME = "Informes");
}
Class EsquemasDatos.DragoAP.Portal360.Informes Extends (%Persistent, %XML.Adaptor) [ ProcedureBlock ]
{
Property"Fecha_Creacion"As%String(MAXLEN = "");Property"Id_Visita"As%String(MAXLEN = "");Property Titulo As%String(MAXLEN = "");Property"Desc_Tipo_Plant"As%String(MAXLEN = "");Property NumExpediente As%String(MAXLEN = "");
}
Then we have developed a Transformation where we would need to get the XML properties and create a certain URL inside an OBX.5 into an ORU_R01 message.
The Transformation code until now is:
Class Transformaciones.DragoAP.Portal360.InformeVisitaRequestToORUEnlacePDF Extends Ens.DataTransformDTL [ DependsOn = (Mensajes.Request.DragoAP.Portal360.InformeVisitaRequest, EnsLib.HL7.Message) ]
{
Parameter IGNOREMISSINGSOURCE = 1;Parameter REPORTERRORS = 1;Parameter TREATEMPTYREPEATINGFIELDASNULL = 0;
XData DTL [ XMLNamespace = "http://www.intersystems.com/dtl" ]
{
<transform sourceClass='Mensajes.Request.DragoAP.Portal360.InformeVisitaRequest' targetClass='EnsLib.HL7.Message' targetDocType='2.5:ORU_R01' create='new' language='objectscript' >
<assign value='##class(Util.TablasMaestras).getValorMaestra("VISOR360.PARAMETROS","url")' property='url' action='set' />
<foreach property='source.Paciente.Informes()' key='k1' >
<assign value='$REPLACE(url, "[nombreDocumento]", source.Paciente.Informes.(k1).Titulo)' property='url' action='set' />
</foreach>
<assign value='url' property='target.{PIDgrpgrp(1).ORCgrp(1).OBXgrp(1).OBX:ObservationValue()}' action='set' />
</transform>
}
}
.png)
But when we try to Test it from the Data Transformation Language Editor in the Studio:
ERROR #6237: Unexpected tag in XML input: “Informes” (ends on line 6, character 20)
.png)
We are testing with this Request:
<test><InformeVisitaRequest><Paciente><NumExpediente>6258338</NumExpediente><Informes><Fecha_Creacion>2024-07-17T11:30:05+01:00</Fecha_Creacion><Id_Visita>8177822</Id_Visita><Titulo>Visita 17/07/2024</Titulo><Desc_Tipo_Plant>99</Desc_Tipo_Plant><NumExpediente>6258338</NumExpediente></Informes></Paciente></InformeVisitaRequest></test>
How could we solve it? Could you give some documentation or advice to solve it?
Thanks for your time.
Thanks for your replies.
Thanks for your help.
🎯🔎☯️🔍🎯
Comments
Hello @Yone Moreno
Try this below input in your DTL. Because the property Informes as a list so you have to create the xml data like below Property Informes As list Of EsquemasDatos.DragoAP.Portal360.Informes(XMLNAME = "Informes");
You can create a main object and set all the properties and use obj.XMLExportToString(.xmlString) for the xml structure of the class object. That will be helpful for forming the input for DTL as well.
<InformeVisitaRequest>
<Paciente>
<NumExpediente>12</NumExpediente>
<Informes>
<Informes>
<Fecha_Creacion>tescreation</Fecha_Creacion>
<Id_Visita>tesVistia</Id_Visita>
<Titulo>tesTitulo</Titulo>
<Desc_Tipo_Plant>Desc_Tipo_Plant</Desc_Tipo_Plant>
<NumExpediente>1212</NumExpediente>
</Informes>
</Informes>
</Paciente>
</InformeVisitaRequest>Thanks!
Thanks @Ashok Kumar T
It worked as you said perfectly fine.
Thanks for your help, and thanks for your kind and detailed explanation Ashok Kumar :=)