Question
· Sep 30, 2019

x12 substring manipulation

How do I manipulate a string in Ensemble DTL (X12 document) to extract a string starting from the right, or end, of the string?

I need to have 10 digit phone numbers, however some of the source data records include the "1" for the long distance dialing and I need to exclude this.

I have tried using Right(), SubStr(), and even SubString(string,*,-10) but it will not compile.

I find it hard to believe that Ensemble does not have the ability to read a string from the right. 

Thank you for any assistance.

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

If you've specified the language as "basic", then I would expect the Right() function to be available. Otherwise, for "objectscript", you'll want to use something like $extract(string,*-10,*).

Edit: if there's some reason to prefer using the methods supplied by the wizard, you could also do something like this: ..SubString(string,..Length(string)-10)