Kyle M · Sep 17, 2020

modifying patient address in DTL


Newbie question. Could you please help me implement the following using DTL only - no programming. 

We have a problem where our system sends longer addresses e.g. block of flats in an unexpected format

e.g. address below:


Flat 22 Kings Court

49 Kings Road


NE10  8AW


Would be sent as

Flat 22^Kings Court^Gateshead^""^NE10  8AW^GBR^HOME^49 Kings Road^


With Road being sent right at the end after the post code and country etc. Shorter addresses are OK.

I need to have a logic which would clean it up and move these values around to have the following:

 Flat 22 Kings Court^49 Kings Road^Gateshead^""^NE10  8AW^GBR^HOME^^


something like:

IF PID;11(1).8 is populated then concatenate PID 11.1 and PID 11.2 (sending both values in PID11.1)

Move PID 11.8 to PID.2

Keep PID 3, PID 4, PID 5 as is


ELSE (PID 11.8 blank)

just pass on the address like below with no changes

129 Princess Road^Gateshead^^^NW10 6TR

1 0 3 113
Log in or sign up to continue



if you read your requirements, that is that you have to write in your DTL

The first line copy all your PID in the new destination (green box)

the condition, check if the 11(1).8 has value, in this case, concatenate PID:11(1).1_PID:11(1).2 to new PID:11(1).1

I understand, when you say "move 11(1).8 to 11(1).2 means that the value in 11(1).8 will be empty (red box), if it is not the case, don't use this line.

For other case (step 7). remove the value of the PID:11(1).8

The DTL conditions are executed in order, It means, that the value in PID:11(1).2 in step 3 is the original then it is replaced by PID:11(1).8 in the following step.

This is the test result:

I hope it helps you,


Kurro Lopez

This is the transformation code (if you want). In my example, I was transforming OUL^R22 to OUL^R22

Class Kurro.DTL.test Extends Ens.DataTransformDTL [ DependsOn = EnsLib.HL7.Message ]


Parameter REPORTERRORS = 1;


XData DTL [ XMLNamespace = "" ]
<transform sourceClass='EnsLib.HL7.Message' targetClass='EnsLib.HL7.Message' sourceDocType='2.7:OUL_R22' targetDocType='2.7:OUL_R22' create='new' language='objectscript' >
<assign value='source.{PIDgrp.PID}' property='target.{PIDgrp.PID}' action='set' />
<if condition='..Length(source.{PIDgrp.PID:11(1).8})&gt;0' >
<assign value='source.{PIDgrp.PID:11(1).1}_" "_source.{PIDgrp.PID:11(1).2}' property='target.{PIDgrp.PID:11(1).1}' action='set' />
<assign value='source.{PIDgrp.PID:11(1).8}' property='target.{PIDgrp.PID:11(1).2}' action='set' />
<assign value='""' property='target.{PIDgrp.PID:11(1).8}' action='set' />
<assign value='""' property='target.{PIDgrp.PID:11(1).8}' action='set' />



Kurro Lopez

Brilliant. Thank you. Much appreciated.