String manipulation on a field during transformation using a ClassMethod.
I need to do some nifty string manipulation on a source property. I will not be able to do it with the functions available(with the knowledge that I have of what is available). Could I call a ClassMethod to do this for me? This is what I want to do: The source property is "myemail@myemaildomain.co.uk". I need to add the text "test" to the beginning of that string. "testmyemail@myemaildomain.co.uk". That should be simple enough, but then I have to do this as well, "testmyemail@myemaildomaintest.co.uk". Note the additional "test" added after "myemaildomain".
I'm assuming you're working with Ensemble (or Interoperability as it's known in the most recent IRIS-based versions) ...
If you create a class that extends Ens.Rule.FunctionSet, not only will you be able to call its methods/functions from the DTL editor, they will appear as selectable functions in the drop-down list.
Now why did I not think of that? Perfect answer, thanks.
Hey Werner.
I know I have ignored your request on how to call a class method (Jeffery has you covered by the looks of things), but you could use $PIECE to break the string apart and then insert what you need.
For example if "source.{PhoneNumberHome(1).Emailaddress}" is equal to "myemail@myemaildomain.co.uk" then
will return:
"testmyemail@myemaildomaintest.co.uk"
The idea being that we
That is the alternative, but I thought it would be "nice" to have another option and you gave it to me. Now I can impress my peers.
Julian. Your answer makes the solution compete. I just put in the Method that was created in Ens.Rule.FunctionSet with a few minor changes and Bob's your uncle.
Thank you Jeffrey and Julian.
Edit: Oops... I see Jeff Drumm already nailed this!
The best way to do this is to define your own custom utility function (which is just a class method). Your custom function will then appear in the function list in the DTL editor along side the standard functions.Social networks
InterSystems resources
Log in or sign up
Log in or create a new account to continue
Log in or sign up
Log in or create a new account to continue
Log in or sign up
Log in or create a new account to continue