I want to build a fetch using attributes that are not in the EOModel because they are calculated. These attributes are updated regularly so using derived attributes in EOModel won't work.
I need to run a fetch for all "open" OrderItems. An "open" order item is simply an OrderItem that has a "scheduledQuantity" less than the "orderedQuantity" (or after doing the math, has an "openQuantity" greater-than 0).
orderedQuantity is a standard attribute that is persisted to the database. scheduledQuantity and openQuantity are not.
I get the scheduledQuantity for a given OrderItem using the following method:
public Number scheduledQuantity() {
Number scheduledQuantity = (Number)valueForKeyPath("email@hiddenuledQuantity");
return new Integer(scheduledQuantity.intValue());
}
Which sums all the scheduledQuantity attributes of the related scheduledManufacturingOrderItem objects.
I calculate the openQuantity by:
public Number openQuantity() {
log.debug("Calculate openQuantity");
int scheduledQuantity = scheduledQuantity().intValue();
int orderedQuantity = orderedQuantity().intValue();
int openQuantity = orderedQuantity - scheduledQuantity;
return openQuantity;
}
I want to fetch all the OrderItems from the database that have an openQuantity > 0, but since the attribute openQuantity is not in EOModeler I can't just simply fetch the same way, can I?
Dave