Question
· May 31, 2023

How could we filter XML elements according to certain criteria?

Hello,

Thanks for reading this question.

How would you recommend to filter out some XML elements according to a certain criteria?

We have the following message with all patient's drug prescriptions, let's call this message [1]:

<?xml version="1.0" ?>
<!-- type: Mensajes.Response.RESNS.RespondingGatewayCrossGatewayQueryResponse  id: 52851815 -->
<RespondingGatewayCrossGatewayQueryResponse>
    <status>urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success</status>
    <requestId/>
    <RegistryObjectList>
        <s01:ExtrinsicObject id="urn:uuid:0e896256-9d21-4a9e-91ca-4de0f445c637" home="urn:oid:2.16.724.4.21" lid="urn:uuid:0e896256-9d21-4a9e-91ca-4de0f445c637" objectType="urn:uuid:34268e47-fdf5-41a6-ba33-82133c465248" status="urn:es:ms:ereceta:names:tc:StatusType:Pending" mimeType="text/xml">
            <s01:Slot name="creationTime">
                <s01:ValueList>
                    <s01:Value>20230515000000</s01:Value>
                </s01:ValueList>
            </s01:Slot>
            <s01:Slot name="lastUpdateTime">
                <s01:ValueList>
                    <s01:Value>20230515000000</s01:Value>
                </s01:ValueList>
            </s01:Slot>
            <s01:Slot name="urn:es:ms:ereceta:names:md:nextUpdateTime">
                <s01:ValueList>
                    <s01:Value>20230630000000</s01:Value>
                </s01:ValueList>
            </s01:Slot>
            <s01:Slot name="sourcePatientId">
                <s01:ValueList>
                    <s01:Value>
                        <![CDATA[BBBBBBBBBZ253268^^^&2.16.724.4.5&ISO]]>
                    </s01:Value>
                </s01:ValueList>
            </s01:Slot>
            <s01:Slot name="languageCode">
                <s01:ValueList>
                    <s01:Value>es-ES</s01:Value>
                </s01:ValueList>
            </s01:Slot>
            <s01:Slot name="repositoryUniqueId">
                <s01:ValueList>
                    <s01:Value>2.16.724.4.21.0</s01:Value>
                </s01:ValueList>
            </s01:Slot>
            <s01:Name>
                <s01:LocalizedString value="ePrescription"/>
            </s01:Name>
            <s01:Description>
                <s01:LocalizedString value="786665^SERTRALINA CINFA 50 mg COMPRIMIDOS RECUBIERTOS CON PELICULA EFG , 30 comprimidos^2.16.724.4.21.5.15.4|1"/>
            </s01:Description>
            <s01:VersionInfo versionName="1"/>
            <s01:Classification id="urn:uuid:24e38c21-8bc7-421f-ad66-c58efa6c52b7" classificationScheme="urn:uuid:41a5887f-8865-4c09-adf7-e362475b143a" classifiedObject="urn:uuid:0e896256-9d21-4a9e-91ca-4de0f445c637" nodeRepresentation="57833-6">
                <s01:Slot name="codingScheme">
                    <s01:ValueList>
                        <s01:Value>2.16.840.1.113883.6.1</s01:Value>
                    </s01:ValueList>
                </s01:Slot>
                <s01:Name>
                    <s01:LocalizedString value="ePrescription"/>
                </s01:Name>
            </s01:Classification>
            <s01:Classification id="urn:uuid:e719c8ac-bb35-47ab-be55-7d83e95cbcf8" classificationScheme="urn:uuid:f0306f51-975f-434e-a61c-c59651d33983" classifiedObject="urn:uuid:0e896256-9d21-4a9e-91ca-4de0f445c637" nodeRepresentation="57833-6">
                <s01:Slot name="codingScheme">
                    <s01:ValueList>
                        <s01:Value>2.16.840.1.113883.6.1</s01:Value>
                    </s01:ValueList>
                </s01:Slot>
                <s01:Name>
                    <s01:LocalizedString value="ePrescription"/>
                </s01:Name>
            </s01:Classification>
            <s01:Classification id="urn:uuid:e3093a1f-4a94-4d9a-b040-05af36c71c8f" classificationScheme="urn:uuid:f4f85eac-e6cb-4883-b524-f2705394840f" classifiedObject="urn:uuid:0e896256-9d21-4a9e-91ca-4de0f445c637" nodeRepresentation="N">
                <s01:Slot name="codingScheme">
                    <s01:ValueList>
                        <s01:Value>2.16.840.1.113883.5.25</s01:Value>
                    </s01:ValueList>
                </s01:Slot>
                <s01:Name>
                    <s01:LocalizedString value="Normal"/>
                </s01:Name>
            </s01:Classification>
            <s01:Classification id="urn:uuid:82f2274b-82f1-4272-b01f-d98192189e8c" classificationScheme="urn:uuid:2c6b8cb7-8b2a-4051-b291-b1ae6a575ef4" classifiedObject="urn:uuid:0e896256-9d21-4a9e-91ca-4de0f445c637" nodeRepresentation="urn:ihe:iti:xdw:2011:eventCode:closed">
                <s01:Slot name="codingScheme">
                    <s01:ValueList>
                        <s01:Value>1.3.6.1.4.1.19376.1.2.3</s01:Value>
                    </s01:ValueList>
                </s01:Slot>
                <s01:Name>
                    <s01:LocalizedString value="Closed"/>
                </s01:Name>
            </s01:Classification>
            <s01:Classification id="urn:uuid:a7940b1d-ae59-48d7-a309-7b43514025e7" classificationScheme="urn:uuid:2c6b8cb7-8b2a-4051-b291-b1ae6a575ef4" classifiedObject="urn:uuid:0e896256-9d21-4a9e-91ca-4de0f445c637" nodeRepresentation="009">
                <s01:Slot name="codingScheme">
                    <s01:ValueList>
                        <s01:Value>2.16.724.4.60.7</s01:Value>
                    </s01:ValueList>
                </s01:Slot>
                <s01:Name>
                    <s01:LocalizedString value="margen de retirada"/>
                </s01:Name>
            </s01:Classification>
            <s01:Classification id="urn:uuid:70112518-ccb2-48a5-a0b1-085a3aeec54f" classificationScheme="urn:uuid:a09d5840-386c-46f2-b5ad-9c3699a4309d" classifiedObject="urn:uuid:0e896256-9d21-4a9e-91ca-4de0f445c637" nodeRepresentation="urn:epSOS:ep:pre:2010">
                <s01:Slot name="codingScheme">
                    <s01:ValueList>
                        <s01:Value>epSOS formatCodes</s01:Value>
                    </s01:ValueList>
                </s01:Slot>
                <s01:Name>
                    <s01:LocalizedString value="epSOS coded ePrescription"/>
                </s01:Name>
            </s01:Classification>
            <s01:Classification id="urn:uuid:2bd31968-235f-4db0-b641-48c56d3b8176" classificationScheme="urn:uuid:f33fb8ac-18af-42cc-ae0e-ed0b0bdb91e1" classifiedObject="urn:uuid:0e896256-9d21-4a9e-91ca-4de0f445c637" nodeRepresentation="C11">
                <s01:Slot name="codingScheme">
                    <s01:ValueList>
                        <s01:Value>2.16.724.4.21.5.10.1</s01:Value>
                    </s01:ValueList>
                </s01:Slot>
                <s01:Name>
                    <s01:LocalizedString value="Hospital General"/>
                </s01:Name>
            </s01:Classification>
            <s01:Classification id="urn:uuid:7da3e9e8-d581-4d61-bb2c-6f2f9f8de090" classificationScheme="urn:uuid:cccf5598-8b07-4b77-a05e-ae952c785ead" classifiedObject="urn:uuid:0e896256-9d21-4a9e-91ca-4de0f445c637" nodeRepresentation="419772000">
                <s01:Slot name="codingScheme">
                    <s01:ValueList>
                        <s01:Value>2.16.724.4.21.5.8.69</s01:Value>
                    </s01:ValueList>
                </s01:Slot>
                <s01:Name>
                    <s01:LocalizedString value="Medicina Familiar y Comunitaria"/>
                </s01:Name>
            </s01:Classification>
            <s01:Classification id="urn:uuid:8a375f15-f7ff-4c37-af60-9961bdec6a79" classificationScheme="urn:uuid:93606bcf-9494-43ec-9b4e-a7748d1a838d" classifiedObject="urn:uuid:0e896256-9d21-4a9e-91ca-4de0f445c637" nodeRepresentation="">
                <s01:Slot name="authorPerson">
                    <s01:ValueList>
                        <s01:Value>^Española Española^Carmen</s01:Value>
                    </s01:ValueList>
                </s01:Slot>
            </s01:Classification>
            <s01:ExternalIdentifier id="urn:uuid:0277b452-dc23-4568-b047-0a2ebb50e325" objectType="urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:ExternalIdentifier" registryObject="urn:uuid:0e896256-9d21-4a9e-91ca-4de0f445c637" identificationScheme="urn:uuid:58a6f841-87b3-4a3e-92fd-a8ffeff98427" value="BBBBBBBBBZ253268^^^&2.16.724.4.5&ISO">
                <s01:Name>
                    <s01:LocalizedString value="XDSDocumentEntry.patientId"/>
                </s01:Name>
            </s01:ExternalIdentifier>
            <s01:ExternalIdentifier id="urn:uuid:ef627120-0342-42cb-8194-95788f97c1bd" objectType="urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:ExternalIdentifier" registryObject="urn:uuid:0e896256-9d21-4a9e-91ca-4de0f445c637" identificationScheme="urn:uuid:2e82c1f6-a085-4c72-9da3-8640a32e42ab" value="2.16.724.4.21.0^29">
                <s01:Name>
                    <s01:LocalizedString value="XDSDocumentEntry.uniqueId"/>
                </s01:Name>
            </s01:ExternalIdentifier>
        </s01:ExtrinsicObject>
        <s01:ExtrinsicObject id="urn:uuid:3774d22f-46cb-41e7-9276-44b280f30726" home="urn:oid:2.16.724.4.21" lid="urn:uuid:3774d22f-46cb-41e7-9276-44b280f30726" objectType="urn:uuid:34268e47-fdf5-41a6-ba33-82133c465248" status="urn:es:ms:ereceta:names:tc:StatusType:Pending" mimeType="text/xml">
            <s01:Slot name="creationTime">
                <s01:ValueList>
                    <s01:Value>20230515000000</s01:Value>
                </s01:ValueList>
            </s01:Slot>
            <s01:Slot name="lastUpdateTime">
                <s01:ValueList>
                    <s01:Value>20230515000000</s01:Value>
                </s01:ValueList>
            </s01:Slot>
            <s01:Slot name="urn:es:ms:ereceta:names:md:nextUpdateTime">
                <s01:ValueList>
                    <s01:Value>20230630000000</s01:Value>
                </s01:ValueList>
            </s01:Slot>
            <s01:Slot name="sourcePatientId">
                <s01:ValueList>
                    <s01:Value>
                        <![CDATA[BBBBBBBBBZ253268^^^&2.16.724.4.5&ISO]]>
                    </s01:Value>
                </s01:ValueList>
            </s01:Slot>
            <s01:Slot name="languageCode">
                <s01:ValueList>
                    <s01:Value>es-ES</s01:Value>
                </s01:ValueList>
            </s01:Slot>
            <s01:Slot name="repositoryUniqueId">
                <s01:ValueList>
                    <s01:Value>2.16.724.4.21.0</s01:Value>
                </s01:ValueList>
            </s01:Slot>
            <s01:Name>
                <s01:LocalizedString value="ePrescription"/>
            </s01:Name>
            <s01:Description>
                <s01:LocalizedString value="769059^CEFAZOLINA NORMON 1 G POLVO Y DISOLVENTE PARA SOLUCIÓN INYECTABLE INTRAMUSCULAR EFG. , 1 vial + 1 ampolla de disolvente^2.16.724.4.21.5.15.4|4"/>
            </s01:Description>
            <s01:VersionInfo versionName="1"/>
            <s01:Classification id="urn:uuid:80a54334-4c7e-45c7-8f3e-158350c0ac1f" classificationScheme="urn:uuid:41a5887f-8865-4c09-adf7-e362475b143a" classifiedObject="urn:uuid:3774d22f-46cb-41e7-9276-44b280f30726" nodeRepresentation="57833-6">
                <s01:Slot name="codingScheme">
                    <s01:ValueList>
                        <s01:Value>2.16.840.1.113883.6.1</s01:Value>
                    </s01:ValueList>
                </s01:Slot>
                <s01:Name>
                    <s01:LocalizedString value="ePrescription"/>
                </s01:Name>
            </s01:Classification>
            <s01:Classification id="urn:uuid:89ad2279-3bc0-4ffd-a591-674a07ee549b" classificationScheme="urn:uuid:f0306f51-975f-434e-a61c-c59651d33983" classifiedObject="urn:uuid:3774d22f-46cb-41e7-9276-44b280f30726" nodeRepresentation="57833-6">
                <s01:Slot name="codingScheme">
                    <s01:ValueList>
                        <s01:Value>2.16.840.1.113883.6.1</s01:Value>
                    </s01:ValueList>
                </s01:Slot>
                <s01:Name>
                    <s01:LocalizedString value="ePrescription"/>
                </s01:Name>
            </s01:Classification>
            <s01:Classification id="urn:uuid:d920a027-645b-4ecc-ae1c-67b66a9180e5" classificationScheme="urn:uuid:f4f85eac-e6cb-4883-b524-f2705394840f" classifiedObject="urn:uuid:3774d22f-46cb-41e7-9276-44b280f30726" nodeRepresentation="N">
                <s01:Slot name="codingScheme">
                    <s01:ValueList>
                        <s01:Value>2.16.840.1.113883.5.25</s01:Value>
                    </s01:ValueList>
                </s01:Slot>
                <s01:Name>
                    <s01:LocalizedString value="Normal"/>
                </s01:Name>
            </s01:Classification>
            <s01:Classification id="urn:uuid:793d569d-12cf-40e7-9cb6-6d4db1d05a94" classificationScheme="urn:uuid:2c6b8cb7-8b2a-4051-b291-b1ae6a575ef4" classifiedObject="urn:uuid:3774d22f-46cb-41e7-9276-44b280f30726" nodeRepresentation="urn:ihe:iti:xdw:2011:eventCode:closed">
                <s01:Slot name="codingScheme">
                    <s01:ValueList>
                        <s01:Value>1.3.6.1.4.1.19376.1.2.3</s01:Value>
                    </s01:ValueList>
                </s01:Slot>
                <s01:Name>
                    <s01:LocalizedString value="Closed"/>
                </s01:Name>
            </s01:Classification>
            <s01:Classification id="urn:uuid:561cca1b-8c16-443b-8e87-cc55a20c1125" classificationScheme="urn:uuid:2c6b8cb7-8b2a-4051-b291-b1ae6a575ef4" classifiedObject="urn:uuid:3774d22f-46cb-41e7-9276-44b280f30726" nodeRepresentation="009">
                <s01:Slot name="codingScheme">
                    <s01:ValueList>
                        <s01:Value>2.16.724.4.60.7</s01:Value>
                    </s01:ValueList>
                </s01:Slot>
                <s01:Name>
                    <s01:LocalizedString value="margen de retirada"/>
                </s01:Name>
            </s01:Classification>
            <s01:Classification id="urn:uuid:0f921e0b-dbde-4309-94fd-62579faab689" classificationScheme="urn:uuid:a09d5840-386c-46f2-b5ad-9c3699a4309d" classifiedObject="urn:uuid:3774d22f-46cb-41e7-9276-44b280f30726" nodeRepresentation="urn:epSOS:ep:pre:2010">
                <s01:Slot name="codingScheme">
                    <s01:ValueList>
                        <s01:Value>epSOS formatCodes</s01:Value>
                    </s01:ValueList>
                </s01:Slot>
                <s01:Name>
                    <s01:LocalizedString value="epSOS coded ePrescription"/>
                </s01:Name>
            </s01:Classification>
            <s01:Classification id="urn:uuid:1bd55f52-2ebb-491b-86cf-3d404b7f017b" classificationScheme="urn:uuid:f33fb8ac-18af-42cc-ae0e-ed0b0bdb91e1" classifiedObject="urn:uuid:3774d22f-46cb-41e7-9276-44b280f30726" nodeRepresentation="C11">
                <s01:Slot name="codingScheme">
                    <s01:ValueList>
                        <s01:Value>2.16.724.4.21.5.10.1</s01:Value>
                    </s01:ValueList>
                </s01:Slot>
                <s01:Name>
                    <s01:LocalizedString value="Hospital General"/>
                </s01:Name>
            </s01:Classification>
            <s01:Classification id="urn:uuid:c6bc3471-f1b3-440a-960e-d54219821319" classificationScheme="urn:uuid:cccf5598-8b07-4b77-a05e-ae952c785ead" classifiedObject="urn:uuid:3774d22f-46cb-41e7-9276-44b280f30726" nodeRepresentation="419772000">
                <s01:Slot name="codingScheme">
                    <s01:ValueList>
                        <s01:Value>2.16.724.4.21.5.8.69</s01:Value>
                    </s01:ValueList>
                </s01:Slot>
                <s01:Name>
                    <s01:LocalizedString value="Medicina Familiar y Comunitaria"/>
                </s01:Name>
            </s01:Classification>
            <s01:Classification id="urn:uuid:ec14fd91-276b-4ec6-96d2-17a461ddf575" classificationScheme="urn:uuid:93606bcf-9494-43ec-9b4e-a7748d1a838d" classifiedObject="urn:uuid:3774d22f-46cb-41e7-9276-44b280f30726" nodeRepresentation="">
                <s01:Slot name="authorPerson">
                    <s01:ValueList>
                        <s01:Value>^Española Española^Carmen</s01:Value>
                    </s01:ValueList>
                </s01:Slot>
            </s01:Classification>
            <s01:ExternalIdentifier id="urn:uuid:86bac986-50d0-4978-a369-48c7d88b48d1" objectType="urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:ExternalIdentifier" registryObject="urn:uuid:3774d22f-46cb-41e7-9276-44b280f30726" identificationScheme="urn:uuid:58a6f841-87b3-4a3e-92fd-a8ffeff98427" value="BBBBBBBBBZ253268^^^&2.16.724.4.5&ISO">
                <s01:Name>
                    <s01:LocalizedString value="XDSDocumentEntry.patientId"/>
                </s01:Name>
            </s01:ExternalIdentifier>
            <s01:ExternalIdentifier id="urn:uuid:0eb5bc74-950c-49af-aac9-5d6c23fc3bb8" objectType="urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:ExternalIdentifier" registryObject="urn:uuid:3774d22f-46cb-41e7-9276-44b280f30726" identificationScheme="urn:uuid:2e82c1f6-a085-4c72-9da3-8640a32e42ab" value="2.16.724.4.21.0^868">
                <s01:Name>
                    <s01:LocalizedString value="XDSDocumentEntry.uniqueId"/>
                </s01:Name>
            </s01:ExternalIdentifier>
        </s01:ExtrinsicObject>
    </RegistryObjectList>
    <totalResultCount>2</totalResultCount>
    <Action>urn:ihe:iti:2007:CrossGatewayQuery</Action>
    <MessageId>urn:uuid:48730310266-1432-1187-7172-238718866625</MessageId>
    <RelatesTo>urn:uuid:48730310266-1432-1187-7172-238718866625</RelatesTo>
    <codSSalud>1</codSSalud>
</RespondingGatewayCrossGatewayQueryResponse>

Currently we are returning this reply, we would call this message [2]:

<?xml version="1.0" ?>
<!-- type: Mensajes.Response.RESNS.RespondingGatewayCrossGatewayRetrieveResponse  id: 52851821 -->
<RespondingGatewayCrossGatewayRetrieveResponse>
	<RegistryResponse status="urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success"/>
	<DocumentResponse>
		<DocumentResponse>
			<s01:HomeCommunityId>2.16.724.4.21</s01:HomeCommunityId>
			<s01:RepositoryUniqueId>2.16.724.4.21.0</s01:RepositoryUniqueId>
			<s01:DocumentUniqueId>2.16.724.4.21.0^868</s01:DocumentUniqueId>
			<s01:mimeType>text/xml</s01:mimeType>
			<s01:Document>PENsa...==</s01:Document>
		</DocumentResponse>
		<DocumentResponse>
			<s01:HomeCommunityId>2.16.724.4.21</s01:HomeCommunityId>
			<s01:RepositoryUniqueId>2.16.724.4.21.0</s01:RepositoryUniqueId>
			<s01:DocumentUniqueId>2.16.724.4.21.0^29</s01:DocumentUniqueId>
			<s01:mimeType>text/xml</s01:mimeType>
			<s01:Document>PENsaW...+</s01:Document>
		</DocumentResponse>
	</DocumentResponse>
	<Action/>
	<MessageId>urn:uuid:48730310266-1432-1187-7172-238718866625</MessageId>
	<RelatesTo/>
	<paciente>
		<s01:indicador_farmacia>TSI 002</s01:indicador_farmacia>
		<s01:subindicador_farmacia>01</s01:subindicador_farmacia>
	</paciente>
</RespondingGatewayCrossGatewayRetrieveResponse>

What would be the recommended way to send the three folowing properties from [1] to [2]?

Slot with name = lastUpdateTime

Slot with name = urn:es:ms:ereceta:names:md:nextUpdateTime

Classification with nodeRepresentation which starts with "00"

 

Currently we have developed the following DTL Transformation:

Class Transformaciones.RESNS.FiltrarFechasyMotivoNoDispensacion Extends Ens.DataTransformDTL [ DependsOn = Mensajes.Response.RESNS.RespondingGatewayCrossGatewayRetrieveResponse ]
{

Parameter IGNOREMISSINGSOURCE = 1;
Parameter REPORTERRORS = 1;
Parameter TREATEMPTYREPEATINGFIELDASNULL = 0;
XData DTL [ XMLNamespace = "http://www.intersystems.com/dtl" ]
{
<transform sourceClass='Mensajes.Response.RESNS.RespondingGatewayCrossGatewayRetrieveResponse' targetClass='Mensajes.Response.RESNS.RespondingGatewayCrossGatewayRetrieveResponse' create='new' language='objectscript' >
<assign value='source.RegistryResponse' property='target.RegistryResponse' action='set' />
<assign value='source.DocumentResponse' property='target.DocumentResponse' action='set' />
<assign value='source.Solicitante' property='target.Solicitante' action='set' />
<assign value='source.Action' property='target.Action' action='set' />
<assign value='source.MessageId' property='target.MessageId' action='set' />
<assign value='source.paciente' property='target.paciente' action='set' />
<assign value='source.RelatesTo' property='target.RelatesTo' action='set' />
<foreach property='source.RegistryObjectList.ExtrinsicObject()' key='k1' >
<foreach property='source.RegistryObjectList.ExtrinsicObject.(k1).Slot()' key='k2' >
<if condition='( source.RegistryObjectList.ExtrinsicObject.(k1).Slot.(k2).name = "lastUpdateTime" )' >
<true>
<code>
<![CDATA[ $$$LOGALERT("Entra lastUpdateTime")]]></code>
<assign value='source.RegistryObjectList.ExtrinsicObject.(k1).Slot.(k2).ValueList.Value.(1)' property='lastUpdateTime' action='set' />
<code>
<![CDATA[ $$$LOGINFO("lastUpdateTime: "_lastUpdateTime)]]></code>
<assign value='lastUpdateTime' property='target.RegistryObjectList.ExtrinsicObject.(k1).Slot.(k2).ValueList.Value.(1)' action='set' />
</true>
</if>
<if condition='( source.RegistryObjectList.ExtrinsicObject.(k1).Slot.(k2).name = "urn:es:ms:ereceta:names:md:nextUpdateTime" )' >
<true>
<code>
<![CDATA[ $$$LOGWARNING("Entra nextUpdateTime")]]></code>
<assign value='source.RegistryObjectList.ExtrinsicObject.(k1).Slot.(k2).ValueList.Value.(1)' property='nextUpdateTime' action='set' />
<code>
<![CDATA[ 
  $$$LOGINFO("nextUpdateTime: "_nextUpdateTime)]]></code>
<assign value='nextUpdateTime' property='target.RegistryObjectList.ExtrinsicObject.(k1).Slot.(k2).ValueList.Value.(1)' action='set' />
</true>
</if>
</foreach>
</foreach>
</transform>
}

}

However the challenge is the following one:

Why we do see the LOGS with lastUpdateTime and nextUpdateTime but those are not being placed into the target?

 

Thanks for your help.

Greetings.

🙏🧑‍💻🔄

Discussion (2)1
Log in or sign up to continue

Could you help us?

We have previously tried to set directly from the visual Data Transformation Language editor to set both last and nextUpdate time as follows:

Class Transformaciones.RESNS.FiltrarFechasyMotivoNoDispensacionAntesDepurarTransf06052023 Extends Ens.DataTransformDTL [ DependsOn = Mensajes.Response.RESNS.RespondingGatewayCrossGatewayRetrieveResponse ]
{

Parameter IGNOREMISSINGSOURCE = 1;

Parameter REPORTERRORS = 1;

Parameter TREATEMPTYREPEATINGFIELDASNULL = 0;

XData DTL [ XMLNamespace = "http://www.intersystems.com/dtl" ]
{
<transform sourceClass='Mensajes.Response.RESNS.RespondingGatewayCrossGatewayRetrieveResponse' targetClass='Mensajes.Response.RESNS.RespondingGatewayCrossGatewayRetrieveResponse' create='new' language='objectscript' >
	<assign value='source.RegistryResponse' property='target.RegistryResponse' action='set' />
	<assign value='source.DocumentResponse' property='target.DocumentResponse' action='set' />
	<assign value='source.Solicitante' property='target.Solicitante' action='set' />
	<assign value='source.Action' property='target.Action' action='set' />
	<assign value='source.MessageId' property='target.MessageId' action='set' />
	<assign value='source.RelatesTo' property='target.RelatesTo' action='set' />
	<assign value='source.paciente' property='target.paciente' action='set' />
	<foreach property='source.RegistryObjectList.ExtrinsicObject()' key='k1' >
		<foreach property='source.RegistryObjectList.ExtrinsicObject.(k1).Slot()' key='k2' >
			<if condition='( source.RegistryObjectList.ExtrinsicObject.(k1).Slot.(k2).name = "lastUpdateTime" )' >
				<true>
					<code>
						<![CDATA[ $$$LOGALERT("Entra lastUpdateTime")]]>
					</code>
					<assign value='source.RegistryObjectList.ExtrinsicObject.(k1).Slot.(k2).ValueList.Value.(1)' property='lastUpdateTime' action='set' />
					<code>
						<![CDATA[ $$$LOGINFO("lastUpdateTime: "_lastUpdateTime)]]>
					</code>
					<assign value='lastUpdateTime' property='target.RegistryObjectList.ExtrinsicObject.(k1).Slot.(k2).ValueList.Value.(1)' action='set' disabled='1' />
					<assign value='lastUpdateTime' property='target.RegistryObjectList.ExtrinsicObject.(1).Slot.(1)' action='set' />
					<code>
						<![CDATA[ $$$LOGASSERT("Después de set lastUpdateTime: "_lastUpdateTime)]]>
					</code>
				</true>
			</if>
			<if condition='( source.RegistryObjectList.ExtrinsicObject.(k1).Slot.(k2).name = "urn:es:ms:ereceta:names:md:nextUpdateTime" )' >
				<true>
					<code>
						<![CDATA[ $$$LOGWARNING("Entra nextUpdateTime")]]>
					</code>
					<assign value='source.RegistryObjectList.ExtrinsicObject.(k1).Slot.(k2).ValueList.Value.(1)' property='nextUpdateTime' action='set' />
					<code>
						<![CDATA[ 
  $$$LOGINFO("nextUpdateTime: "_nextUpdateTime)]]>
					</code>
					<assign value='nextUpdateTime' property='target.RegistryObjectList.ExtrinsicObject.(k1).Slot.(k2).ValueList.Value.(1)' action='set' disabled='1' />
					<assign value='nextUpdateTime' property='target.RegistryObjectList.ExtrinsicObject.(2).Slot.(1)' action='set' />
					<code>
						<![CDATA[ $$$LOGASSERT("Después de set nextUpdateTime: "_nextUpdateTime)]]>
					</code>
				</true>
			</if>
		</foreach>
	</foreach>
</transform>
}

}

However, the previous attempt did not work because of it does assign lastUpdateTime and nextUpdateTime but it does not put them in the target message...

Currently we have developed and tested this other approach and it does work as intendeed, however; how could we simplify and/or make it more understandable?

Class Transformaciones.RESNS.FiltrarFechasyMotivoNoDispensacion Extends Ens.DataTransformDTL [ DependsOn = Mensajes.Response.RESNS.RespondingGatewayCrossGatewayRetrieveResponse ]
{

Parameter IGNOREMISSINGSOURCE = 1;

Parameter REPORTERRORS = 1;

Parameter TREATEMPTYREPEATINGFIELDASNULL = 0;

XData DTL [ XMLNamespace = "http://www.intersystems.com/dtl" ]
{
<transform sourceClass='Mensajes.Response.RESNS.RespondingGatewayCrossGatewayRetrieveResponse' targetClass='Mensajes.Response.RESNS.RespondingGatewayCrossGatewayRetrieveResponse' create='existing' language='objectscript' >
	<assign value='##class(EsquemasDatos.RESNS.rim.RegistryObjectListType).%New()' property='target.RegistryObjectList' action='set' />
	<assign value='0' property='indiceExtrinsicObjectCreados' action='set' />
	<assign value='0' property='indiceSlotsCreados' action='set' />
	<foreach property='source.RegistryObjectList.ExtrinsicObject()' key='k1' >
		<foreach property='source.RegistryObjectList.ExtrinsicObject.(k1).Slot()' key='k2' >
			<if condition='( source.RegistryObjectList.ExtrinsicObject.(k1).Slot.(k2).name = "lastUpdateTime" )' >
				<true>
					<code>
						<![CDATA[ $$$LOGALERT("Entra lastUpdateTime")]]>
					</code>
					<assign value='source.RegistryObjectList.ExtrinsicObject.(k1).Slot.(k2).ValueList.Value.(1)' property='lastUpdateTime' action='set' />
					<code>
						<![CDATA[ $$$LOGINFO("lastUpdateTime: "_lastUpdateTime)]]>
					</code>
					<code>
						<annotation>Creamos Slot lastUpdateTime</annotation>
						<![CDATA[ 
  
  set extrinsicObject = ##class(EsquemasDatos.RESNS.rim.ExtrinsicObjectType).%New()
  
  do target.RegistryObjectList.ExtrinsicObject.Insert(extrinsicObject)
  
  set indiceExtrinsicObjectCreados = target.RegistryObjectList.ExtrinsicObject.Count()
  
  set slot = ##class(EsquemasDatos.RESNS.rim.SlotType1).%New()
  
  set slot.name = "lastUpdateTime"
  
  do target.RegistryObjectList.ExtrinsicObject.GetAt(indiceExtrinsicObjectCreados).Slot.Insert(slot)
  
  set indiceSlotsCreados = target.RegistryObjectList.ExtrinsicObject.GetAt(indiceExtrinsicObjectCreados).Slot.Count()

  set valueList = ##class(EsquemasDatos.RESNS.rim.ValueListType).%New()
  
  set target.RegistryObjectList.ExtrinsicObject.GetAt(indiceExtrinsicObjectCreados).Slot.GetAt(indiceSlotsCreados).ValueList = valueList

  do target.RegistryObjectList.ExtrinsicObject.GetAt(indiceExtrinsicObjectCreados).Slot.GetAt(indiceSlotsCreados).ValueList.Value.Insert(lastUpdateTime)
   
   ]]>
					</code>
					<assign value='source.RegistryObjectList.ExtrinsicObject.(k1).id' property='target.RegistryObjectList.ExtrinsicObject.(indiceExtrinsicObjectCreados).id' action='set' />
					<assign value='source.RegistryObjectList.ExtrinsicObject.(k1).home' property='target.RegistryObjectList.ExtrinsicObject.(indiceExtrinsicObjectCreados).home' action='set' />
					<assign value='source.RegistryObjectList.ExtrinsicObject.(k1).lid' property='target.RegistryObjectList.ExtrinsicObject.(indiceExtrinsicObjectCreados).lid' action='set' />
					<assign value='source.RegistryObjectList.ExtrinsicObject.(k1).objectType' property='target.RegistryObjectList.ExtrinsicObject.(indiceExtrinsicObjectCreados).objectType' action='set' />
					<assign value='source.RegistryObjectList.ExtrinsicObject.(k1).status' property='target.RegistryObjectList.ExtrinsicObject.(indiceExtrinsicObjectCreados).status' action='set' />
					<assign value='source.RegistryObjectList.ExtrinsicObject.(k1).mimeType' property='target.RegistryObjectList.ExtrinsicObject.(indiceExtrinsicObjectCreados).mimeType' action='set' />
					<code>
						<![CDATA[ $$$LOGASSERT("Después de set lastUpdateTime: "_lastUpdateTime)]]>
					</code>
				</true>
			</if>
			<if condition='( source.RegistryObjectList.ExtrinsicObject.(k1).Slot.(k2).name = "urn:es:ms:ereceta:names:md:nextUpdateTime" )' >
				<true>
					<code>
						<![CDATA[ $$$LOGWARNING("Entra nextUpdateTime")]]>
					</code>
					<assign value='source.RegistryObjectList.ExtrinsicObject.(k1).Slot.(k2).ValueList.Value.(1)' property='nextUpdateTime' action='set' >
						<annotation>Añadimos Slot nextUpdateTime</annotation>
					</assign>
					<code>
						<![CDATA[ 
  $$$LOGINFO("nextUpdateTime: "_nextUpdateTime)]]>
					</code>
					<code>
						<![CDATA[ 

  set slot = ##class(EsquemasDatos.RESNS.rim.SlotType1).%New()
  
  set slot.name = "nextUpdateTime"
  
  do target.RegistryObjectList.ExtrinsicObject.GetAt(indiceExtrinsicObjectCreados).Slot.Insert(slot)
  
  set indiceSlotsCreados = target.RegistryObjectList.ExtrinsicObject.GetAt(indiceExtrinsicObjectCreados).Slot.Count()

  set valueList = ##class(EsquemasDatos.RESNS.rim.ValueListType).%New()
  
  set target.RegistryObjectList.ExtrinsicObject.GetAt(indiceExtrinsicObjectCreados).Slot.GetAt(indiceSlotsCreados).ValueList = valueList

  do target.RegistryObjectList.ExtrinsicObject.GetAt(indiceExtrinsicObjectCreados).Slot.GetAt(indiceSlotsCreados).ValueList.Value.Insert(nextUpdateTime)
   
   ]]>
					</code>
					<code>
						<![CDATA[ $$$LOGASSERT("Después de set nextUpdateTime: "_nextUpdateTime)]]>
					</code>
				</true>
			</if>
		</foreach>
	</foreach>
	<foreach property='source.RegistryObjectList.ExtrinsicObject()' key='k1' >
		<foreach property='source.RegistryObjectList.ExtrinsicObject.(k1).Classification()' key='k3' >
			<code>
				<![CDATA[ 
  set node = source.RegistryObjectList.ExtrinsicObject.GetAt(k1).Classification.GetAt(k3).nodeRepresentation]]>
			</code>
			<code disabled='1' >
				<![CDATA[ 
  $$$LOGINFO("node: "_node)]]>
			</code>
			<code disabled='1' >
				<![CDATA[ 
  $$$LOGALERT("$FIND(node, 00): "_$FIND(node, "00"))]]>
			</code>
			<if condition='( $FIND(node, "00") = 3)' >
				<annotation>Si nodeRepresentation empieza por &quot;00&quot;</annotation>
				<true>
					<code>
						<![CDATA[ 
  $$$LOGWARNING("sí empieza por 00 el nodeRepresentation")]]>
					</code>
					<assign value='source.RegistryObjectList.ExtrinsicObject.(k1).Classification.(k3).Slot.(1).ValueList.Value.(1)' property='nodeValue' action='set' />
					<code>
						<![CDATA[  $$$LOGWARNING("nodeValue: "_nodeValue)]]>
					</code>
					<assign value='source.RegistryObjectList.ExtrinsicObject.(k1).Classification.(k3).Name.LocalizedString.(1).value' property='localizedStringValue' action='set' />
					<code>
						<![CDATA[  $$$LOGALERT("localizedStringValue: "_localizedStringValue)]]>
					</code>
					<code>
						<annotation>Generamos y asignamos Slot y Name del motivo NO dispensación</annotation>
						<![CDATA[ 
  
  set classification = ##class(EsquemasDatos.RESNS.rim.ClassificationType).%New()
  
  do target.RegistryObjectList.ExtrinsicObject.GetAt(k1).Classification.Insert(classification)
  
  set indiceClassificationCreados = target.RegistryObjectList.ExtrinsicObject.GetAt(k1).Classification.Count()
  
  set slot = ##class(EsquemasDatos.RESNS.rim.SlotType1).%New()
  
  set slot.name = "codingScheme"
  
  do target.RegistryObjectList.ExtrinsicObject.GetAt(k1).Classification.GetAt(indiceClassificationCreados).Slot.Insert(slot)
  
  set indiceSlotsCreados = target.RegistryObjectList.ExtrinsicObject.GetAt(indiceExtrinsicObjectCreados).Slot.Count()

  set valueList = ##class(EsquemasDatos.RESNS.rim.ValueListType).%New()
  
  set target.RegistryObjectList.ExtrinsicObject.GetAt(k1).Classification.GetAt(1).Slot.GetAt(1).ValueList = valueList

  do target.RegistryObjectList.ExtrinsicObject.GetAt(k1).Classification.GetAt(1).Slot.GetAt(1).ValueList.Value.Insert(nodeValue)
   
  set name = ##class(EsquemasDatos.RESNS.rim.InternationalStringType).%New()
  
  set localizedString = ##class(EsquemasDatos.RESNS.rim.LocalizedStringType).%New()
  
  set localizedString.value = localizedStringValue
  
  do name.LocalizedString.Insert(localizedString)
  
  set target.RegistryObjectList.ExtrinsicObject.GetAt(k1).Classification.GetAt(1).Name = name

]]>
					</code>
					<assign value='source.RegistryObjectList.ExtrinsicObject.(k1).Classification.(k3).id' property='target.RegistryObjectList.ExtrinsicObject.(k1).Classification.(1).id' action='set' />
					<assign value='source.RegistryObjectList.ExtrinsicObject.(k1).Classification.(k3).classificationScheme' property='target.RegistryObjectList.ExtrinsicObject.(k1).Classification.(1).classificationScheme' action='set' />
					<assign value='source.RegistryObjectList.ExtrinsicObject.(k1).Classification.(k3).classifiedObject' property='target.RegistryObjectList.ExtrinsicObject.(k1).Classification.(1).classifiedObject' action='set' />
					<assign value='source.RegistryObjectList.ExtrinsicObject.(k1).Classification.(k3).nodeRepresentation' property='target.RegistryObjectList.ExtrinsicObject.(k1).Classification.(1).nodeRepresentation' action='set' />
				</true>
			</if>
		</foreach>
	</foreach>
</transform>
}

}

🤔👁👁🌟🐢🐝🚀👁👁🤔

how could we simplify and/or make it more understandable?

Thanks for your replies.