2

I am using Studio and have a need to use MVEL expressions. Can someone please tell me how can I extract all the characters in a field after underscore character.I am reading these values from an XML file.Please see below example.

Action:

NEW_3456
NEW_CW234789

So, I want my MVEL expresion to extract all the values after underscore. So, the result for the above expression should be 3456 and CW234789 respectively.

Here is what I am using : Declare a variable to navigate and pick the Action field value.

Lets say the variable declared is

props['applicant.Status1'] 

The value of this variable is :

props['applicant.Status1'] = parts[0].xpath('/row/Action/normalize-space(substring(text(),5,8))')

The output is 3456 and CW23 which is fine.

Now here is the issue, in order to extract all the value aftre underscore I used the below expression and I am not getting the deired value.

props['applicant.Status1'] = parts[0].xpath('/row/Action/normalize-space(substring-after(text(),5))')

Can someone please tell me if the above expresion is correct. Is there some other way I can get the value I am desiring. Thanks!

Yaseen Ahmad
  • 1,807
  • 5
  • 25
  • 43
Sudha Rani
  • 89
  • 3
  • 9

1 Answers1

0

"Can someone please tell me how can I extract all the characters in a field after underscore character"

This should be straightforward given that you knew about substring-after() function :

/row/Action/normalize-space(substring-after(., "_"))
har07
  • 88,338
  • 12
  • 84
  • 137