Enumeration in XPath constraint

3
I've got a Java action which receives a "job status" enumeration value as input and tries to retrieve all the jobs whose status corresponds to the value passed in. The enumeration PipsAndSubbies.JobStatus is in { "Complete", "Scheduled", "Billed", "Rejected" }. Given a status targetStatus of type PipsAndSubbies.JobStatus with one of these values, I want to retrieve all the Jobs whose jobStatus matches targetStatus. This seemed to work until I upgraded to 2.5: List<imendixobject> jobs = Core.retrieveXPathQueryEscaped(getContext(), "//PipsAndSubbies.Job [jobStatus = %s]", targetStatus.toString()); but in 2.5.1 it is giving me errors like this. com.mendix.core.CoreException: com.mendix.core.CoreException: com.mendix.core.CoreException: kC: Object 'PipsAndSubbies.Job' doesn't contain member 'Rejected', exception occurred on mapping the following query: SELECT PipsAndSubbies.Job.* FROM PipsAndSubbies.Job WHERE PipsAndSubbies.Job.jobStatus = PipsAndSubbies.Job.Rejected Obviously I want to compare with PipsandSubbies.JobStatus, not PipsAndSubbiesJob. What's the correct syntax please?
asked
1 answers
5

You forgot about the quotes, and now the value is parse as a member instead of a value:

List<imendixobject> jobs = Core.retrieveXPathQueryEscaped(getContext(), "//PipsAndSubbies.Job [jobStatus = '%s']", targetStatus.toString());
answered