Hi,
Context: I want to display all parts whose inventory is not empty. I have a page that use a WODisplayGroup and a fetchspec built into EntityModeler to extract from the database some subcategories.

Schema: My Part class has a one2many relationship to a Transaction class. Each transaction has a quantity field , positive when things are put in inventory and negative when taken out. Each Transaction also has a date field.

In my lists, to display current inventory, I use a method on my Part class like

// __________________________________________________________________________________________________________________
        public Number partCount() {
                return (Number) transactions().valueForKey("@sum.quantity");
        }
// __________________________________________________________________________________________________________________


Question 1: I would like to display parts with the sum of transactions quantities is greater than 0

question 2: Eventually , I would like to further filter the transactions so that only those before a certain date are considered into the sum.


My current guess would be to manually remove parts by looping through the WODisplaygroup.allObjects() array and removing parts that do not qualify.

Question 1.1: where would I filter this, in appendToResponse where I currently call dg.fetch ?

As for the second question, I could write a new partCount that would take a date as a parameter and loop through hall transactions into the arrays and only add quantities that qualify.


Would those approach make sense and qualify as the WOWay of doing things ?



Louis Demers eng.
www.obzerv.com


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to