· Jul 29, 2020

DTL - X12 strip of "/" in phone number

I am having difficulties with using the ..Strip() function in my DTL to strip the slash ( / ) from the phone number portion of an x12 834.  There are very few records that have the slash in the phone number, so I am trying to filter out any characters other than numbers so that all phone numbers are formatted 1112223333.

Here is the code portion of the strip:

       Set           HomePhone             ..Strip(source.{loop2000(k1).loop2100A.PER:CommunicationNumber},"*AW","-()/").

I am then checking the length of HomePhone.

     1.  If it is less than 10 characters (not a full phone number), it is assigned as blank ("").

     2. Else the phone number is formatted as such:  $extract(HomePhone,*-9,10)

The problem phone number from the source file is formatted as : 111/2223333.  The transformation is producing: 11/222333, where it is cutting off the leading and final numbers of the phone number.

This means two things are happening.

     1. It is not recognizing the portion of the Strip function to remove the slash.

     2. It is not following the If logic to assign nothing to the phone number field if the length is less than 10.  The produced string is 9 characters.


I read in the DTL documentation that the DTL is encoded using XML.  Could the presence of the ( / ) in either the Strip function or the actual phone number string be causing an XML issue?  Is the ( / ) a control character in XML and if so, how do I escape that to read it as a string character?

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

Chris.... Thank you for your input on this issue.  The solution ended up being a lot easier. It was user error. 

I had created a second version of this DTL to test out modification for anticipated future file formats.  The DTL is actually used as a subtransformation, so the outer DTL was pointed to the second version while I was making the above modifications on the original version. 

The simple solution ended up being:      ..Strip(source.{loop2000(k1).loop2100A.PER:CommunicationNumber},"*AW","-()/")