Compare enum value with string

0
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.  
asked
3 answers
3

Hi Shivam, 

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

answered
1

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

 

answered
0

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

answered