How I compare fields from the same entity to filter an entity list

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How I compare fields from the same entity to filter an entity list

Christian Carlow-OFBizzer
Hi,

I'm trying to filter an entity list where two of the entity fields do not equal one another.

I realize I can retrieve the list and while looping the results compare the fields manually in code, but it would be better if I could apply the condition in the SQL statement itself.

I've looked into the entity-condition and condition-expr but they seem to require a value to be somewhat statically specified.  This seems to be the case for the EntityCondition.makeCondition method for the findList method as well.

My question is, if I want to get a list of all inventoryItem records where the availableToPromise is not equal to the accountingQuantityTotal for example, how might I do so?

Basically I'm trying to get the SQL WHERE CLAUSE to be WHERE inventory_item.available_to_promise != inventory_item.accounting_quantity_total.  Is this possible using the entity engine?
Reply | Threaded
Open this post in threaded view
|

Re: How I compare fields from the same entity to filter an entity list

Christian Carlow-OFBizzer
Found this post with a similar question from 2007 but it was never answered.

http://ofbiz.135035.n4.nabble.com/Entity-Condition-to-compare-database-fields-td150083.html