Gary Koester · Apr 27

replacing characters

The doc name is formatted lname,fname. How do I replace the comma with a ^ so I get lname^fname.


<assign value='$ZCVT(source.{},"i","XML")' property='target.{PV1:AdmittingDoctor(1).GivenName}' action='set' />

Product version: Caché 2017.1
$ZV: Cache for Windows (x86-64) 2017.2.2
0 186
Discussion (3)2
Log in or sign up to continue
<assign value='$PIECE($ZCVT(source.{},"i","XML"),",",1)' property='target.{PV1:AdmittingDoctor(1).FamilyName}' action='set' />
<assign value='$PIECE($ZCVT(source.{},"i","XML"),",",2)' property='target.{PV1:AdmittingDoctor(1).GivenName}' action='set' />

Or a bit more efficiently:

<assign value='$ZCVT(source.{},"i","XML")' property='tFullName' action='set' />
<assign value='$PIECE(tFullName,",",1)' property='target.{PV1:AdmittingDoctor(1).FamilyName}' action='set' />
<assign value='$PIECE(tFullName,",",2)' property='target.{PV1:AdmittingDoctor(1).GivenName}' action='set' />

Note that this isn't actually replacing the comma character so much as it's splitting the full name value supplied in the source path on that character and assigning the individually extracted values to their associated HL7 components in the Admitting Doctor field.

could consider  $Translate(Var,",","^") but I've not used it in the context in your example though