The Job object has a negative id, this means it has not been inserted in the database yet. If there should be only one job in the database for a certain job number, retrieving a count for jobs with a certain job number would indeed be a good solution to check whether a similar job (i.e. a job with the same job number) already exists.
You could use the id
"attribute" of the object to ensure that you do not retrieve the same object as follows:
//Job[id != $job/id and jobNumber = $job/jobNumber]
I wrote this:
[id != $InputJobObject/id and jobNumber = $InputJobObject/jobNumber]
and it threw one of these:
XPathTextGetRequest (depth = 0): //PipsAndSubbies.Job['1' = jobNumber and -281466386776064 != id] 2009-09-10 17:19:03.134 ERROR - MICROFLOWENGINE: java.lang.RuntimeException: Unknown left predicate token: [(DefaultUnaryExpr): [(DefaultNumberExpr): 2.81466386776064E14]]
The only thing I can think of is that $InputJobObject hasn't been committed yet. Might that be the cause? I guess I could retrieve the whole list and check its cardinality