Comparing object identities

5
I'm looking for duplicates in my database when uploading records from a file. I've written a microflow activity which tries to retrieve an object (a "Job") with the same key ("jobNumber"), but clearly I don't want to include the job I'm comparing it with? // Job [ $InputJobObject/jobNumber = jobNumber and $InputJobObject != what? ].
asked
3 answers
5

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.

answered
3

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]
answered
1

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

answered