Pattern Designer - Transform Table Operation

Chris Ellis
Tera Expert

Good day, all.

I have a table of JMS Connections that includes several columns of info. One column in particular has URL-like data (meaning it contains a host, port, and some garbage I do not want) in it that I would like to parse into two additional columns (one for host and one for port) using the Transform Table operation.

I have attempted to use an EVAL statement (below) to attempt to extract the host, but it is giving me an "Illegal group reference." error.

EVAL(javascript:var rtrn = ''; var regex = /(?<=\/\/)(.*)(?=:)/; var jms_host = ${$JMSConnections[*].extProviderURL}; rtrn = regex.exec(jms_host);)

 

Here is a sample table of data: 

extProviderURLjndiNametypeforEach
jmsnaming://serverA.com:1234TibcoABC123QUEUE/opt/WebSphere/.../resources.xml
jmsnaming://serverA.com:1234TibcoABC321QUEUE/opt/WebSphere/.../resources.xml
jmsnaming://serverB.com:1234TibcoABC789QUEUE/opt/WebSphere/.../resources.xml
jmsnaming://serverB.com:1234TibcoABC987QUEUE/opt/WebSphere/.../resources.xml

 

And here is what I would want to see:

extProviderURLjndiNametypejms_hostforEach
jmsnaming://serverA.com:1234TibcoABC123QUEUEserverA.com/opt/WebSphere/.../resources.xml
jmsnaming://serverA.com:1234TibcoABC321QUEUEserverA.com/opt/WebSphere/.../resources.xml
jmsnaming://serverB.com:1234TibcoABC789QUEUEserverB.com/opt/WebSphere/.../resources.xml
jmsnaming://serverB.com:1234TibcoABC987QUEUEserverB.com/opt/WebSphere/.../resources.xml

 

Anyone have any ideas on how to do this?

Thanks!

1 ACCEPTED SOLUTION

Prince7
ServiceNow Employee
ServiceNow Employee

Use Transform Table operation, source and target table will be same and in fieldname provide jms_hostname, value will be eval script. try below script

var rtrn = '';
var data = ${table_name[].extProviderURL};
var match = /.*\/\/(.*):.*/.exec(data);
if(match){
interfaceName = match[1];
}

rtrn;

View solution in original post

1 REPLY 1

Prince7
ServiceNow Employee
ServiceNow Employee

Use Transform Table operation, source and target table will be same and in fieldname provide jms_hostname, value will be eval script. try below script

var rtrn = '';
var data = ${table_name[].extProviderURL};
var match = /.*\/\/(.*):.*/.exec(data);
if(match){
interfaceName = match[1];
}

rtrn;