Compare enum value with string

Hi Team ,  I have a situation where my published rest service is bring a country value(string) in request body . I have that value saved in an entity and based on the country value i have to return list of records . Now the country value in my source entity is enum and the value coming in request is string due to which i am not able to put condition in my xpath . Can someone help me how can i write the xpath with the above mentioned scenario.  
3 answers

Hi Shivam, 

Can you share the page where you implemented this page to Know about the structure used in a page.


Rather than doing this in your XPath, may i suggest you first convert your countryname from type string to type enum. You can do so by Bart Rikers brilliant answer to my question: create a one-liner Java-widget that take one input parameter, the countryname of type string, and one return attribute, the countryname of type enumeration



You can put the “Name” of your ENUM into the Xpath as a String. 

For example… If the ENUM had the Caption as the country’s full name (e.g. United Kingdom), and the Name as their code (e.g. UK), then if you had an entity with a Country attribute using this ENUM, you could find all matching entities that had the UK as their country by just using ‘UK’ as the value. e.g. [Country = ‘UK’]

Hope this helps