On Feb 6, 2006, at 1:15 PM, Scott Winn wrote:

Company
        (PK) company_id
        Relationship: Sellers (to Many)

Seller
        (PK) seller_id
        (FK) seller_company_id
        seller_code
        Relationship: Company (to One)

My code successfully gets a Company object from the database (referred to as import_Company below). It also retrieves a String called source_code to compare with the Seller object's seller_code to help narrow the search.

What I want is essentially an object from Seller where (seller_company_id == import_Company.company_id) and (seller_code == source_code)

        You could filter the company.sellers() array:

EOQualifier qualifier = new EOKeyValueQualifier("seller_code", EOQualifier.QualifierOperatorLike, company.sourceCode()); NSArray sellers = EOQualifier.filteredArrayWithQualifier (company.sellers(), qualifier);

But this would result in all Sellers of the current Company being fetched if they haven't already been.

        Or you could fetch just the Sellers that satisfy the criteria:

NSDictionary values = new NSDictionary(new Object[] {company, company.sourceCode()}, new String[] {"company", "sellerCode"}); NSArray sellers = EOUtilities.objectsMatchingValues(editingContext, "Seller", values);

Aloha,
Art

_______________________________________________
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