I think I would create a view-entity that aliased all of the fields you have
here and added a complex-alias for the difference of the actual and
estimated net amounts.  Something like --

        <alias name="actualEstimatedDelta">
            <complex-alias operator="-">
                <complex-alias-field entity-alias="E1"
field="actualNetAmount"/>
                <complex-alias-field entity-alias="E1"
field="estimatedNetAmount"/>
            </complex-alias>
        </alias>

Then do your entity condition on this field in your v-e.

<condition-expr field="actualEstimatedDelta" operator="greater" value="0"/>

Bob


snowc wrote:
> 
> I have some legacy data that I am trying to access in ofbiz.
> 
> <entity name="E1">
>   <field name="e1ID"/>
>   <field name="actualNetAmount"/>
>   <field name="estimatedNetAmount"/>
> </entity>
> 
> Conceptually, I want to filter as shown here:
> 
> SELECT e1Id, actualNetAmount, estimatedNetAmount
> FROM E1 WHERE actualNetAmount > estimatedNetAmount
> 
> <entity-condition entity="E1">
>    <condition-expr field="actualNetAmount" operator="greater"
> value="${this.estimatedNetAmount}"/>
> </entity-condition>
> 
> How can I achieve the equivalent of "this" is a entity condition
> expression?
> 
> I do not want to filter by iterating the list as the data volumes are
> huge.  
> 
> One option I am thinking of is to create a SQL view and use that to filter
> the data:
> 
> SELECT 
> e1Id, actualNetAmount, estimatedNetAmount,
> CASE 
>   WHEN actualNetAmount > estimatedNetAmount THEN 1 
>   ELSE 0 
> END CASE AS actualGTEstimated
> FROM E1 
> 
> Maybe I could use DynamicViewEntities, but I was trying to use less
> beanshell/java and more minilang.
> 
> Many thanks in advance, Chris
> 
> 

-- 
View this message in context: 
http://www.nabble.com/entity-condition-expression-problem-tp25010865p25018276.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Reply via email to