Wednesday, June 29, 2011

Oracle BPEL XPath: How to check if a value exists in a list of values?

Use the following XPath function available within the BPEL XPath function library:

xp20:matches(string(bpws:getVariableData('inputVariable','payload','/ns1:RuntimeFaultMessage/ns1:code')),'^(ABCD)$') = true()

Things to remember:

  • Use string (element data) since the bpws:getVariableData returns an Object and not a string and should be converted to string using th string() function.


  • The above function matches if the variable data has the value equals A or B or C or D using the '^(ABCD)$' and this expression can be replaced with other regular expressions for similar comparisons


  • Use true() and not true for comparing the condition
  • 5 comments:

    Anonymous said...

    Great ! The code logic that I applied to check this point is bit complex from the one you have posted. I am highly convinced with the solution that you have suggested to check if a value exists in a list. Thanks for sharing.
    sap erp system

    Anonymous said...
    This comment has been removed by the author.
    Anonymous said...
    This comment has been removed by the author.
    Anonymous said...
    This comment has been removed by the author.
    Anonymous said...

    Great !

    Search This Blog