Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
Highlighted
tripathi.aayush Absent Member.
Absent Member.
949 views

Is it Possible to Extract a Substring using Evaluate Velocity Template Variable

Hi All,

I am looking forward to extract an "IP Address" from the filed named "File name" using Evaluate Velocity Template variable.

The event in the field looks like "UseCase - 1.1.1.1 xxxxxx" where "xxxxx" may be any random string which may/may not be present.

Is it possible to extract the IP address from the event filed using specifically "Evaluate Velocity Template", if Yes then please suggest your valuable inputs to achive the objective.

Thanks & Regards

Aayush Tripathi

Labels (2)
0 Likes
1 Reply
Outstanding Contributor.. LakeHealthInfoS Outstanding Contributor..
Outstanding Contributor..

Re: Is it Possible to Extract a Substring using Evaluate Velocity Template Variable

Yes but you need to break the Fields down in indexed chunks using more than likely a combination of String and Add variables ------

the first step would be to alias your ---- Original Field contents to a different field ---------

Source User Name  = sourceUN

than do

index of sourceUN -----some delimiter  -----

then add of the index above and 1

then  substing of the Original source field, the index and -1

than the final evaluate velocity template would look like this ----------

(#if($Index_X>0)$Sub-StingVariable_X#elseif($Index_Y>0)$Sub-StingVariable_Y#else$sourceUN#end)

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.