Hi Markus,

you need a GROUP BY HAVING COUNT because one DocumentText can not satisfy your 
qualifier.
Unfortunately this does not work with a common qualifier.

I once modified PostgresqlExpression to allow for a GROUP BY:

// added by atze to support GROUP BY
public void prepareSelectExpressionWithAttributes(NSArray nsarray, boolean 
flag, EOFetchSpecification eofetchspecification)
{
        super.prepareSelectExpressionWithAttributes(nsarray, flag, 
eofetchspecification);
        String aGroupBy = 
(String)eofetchspecification.hints().objectForKey("GROUP BY");
        if(aGroupBy != null)
        {
                EOAttribute anAttribute = 
EOModelGroup.defaultGroup().entityNamed(eofetchspecification.entityName()).attributeNamed(aGroupBy);
                String aDefinition = (anAttribute.isDerived() ? 
anAttribute.definition() : anAttribute.columnName());
                setStatement(statement() + " GROUP BY "+ aDefinition);
        }
}

Maybe that helps a bit.

        atze



Am 12.12.2013 um 14:56 schrieb Markus Ruggiero <[email protected]>:

> On first sight it looks pretty simple, but the more I think of a solution the 
> more confused I become. Can someone help me build a qualifier for entity 
> "Document" please:
> 
> Model:
> 
> Document <--->>DocumentText<<--->Text
> 
> DocumentText is NOT a simple many2many join but has its own attributes. When 
> I create a Document I assign a pre-defiend set of Text objects to it. This 
> means I create a number of DocumentText objects each pointing to one Text. 
> These DocumentText objects are presented to the user as a list of 
> "attributes" of a Document. The user then specifies a textual comment (for 
> the field DocumentText.COMMENT_KEY) and a status value (for 
> DocumentText.STATUS_KEY) on any one or more of these DocumentText objects. 
> Upon save I update those 2 or 3 or 4... DocumentText objects accordingly. For 
> many of them the user does not enter anything (status is a known default, 
> comment is empty). This all works.
> 
> Now comes the qualifier to retrieve Documents: The user sees a D2WQueryPage 
> for the document properties with an embedded property level query component 
> that presents the full list of possible DocumentText objects with their 
> status and comment fields. A typical scenario could be: the user wants to 
> enter a comment query for the second assigned text (that's Text "A") and/or 
> picks a query value for the status of the 7th assigned text (this could be 
> Text "B"). Upon executing the query the user expects to retrieve a list of 
> Documents that fulfill all given criteria. In this example the user wants to 
> see all Documents where the assignment to Text "A" has comment "x" AND the 
> assignment to Text "B" has status "y".
> 
> I have this working for the case where the user only gives one search 
> criterium but I cannot figure out how to construct the qualifier for the 
> combination. An OR qualifier returns all Documents where any one DocumentText 
> is satisfied whereas an AND qualifier returns nothing. I do understand those 
> two cases. Mind you the top level entity must be Document, because that's 
> what the user works with and queries against. In my property level query 
> component I have set-Methods for the status and the comment values on the 
> DocumentText loopvar. These methods retrieve the displayGroup qualifier and 
> manipulate it. But not knowing how the final qualifier should look I am at a 
> loss.
> 
> Thanks for any help
> ---markus---
> 
> 
> 
> 
> Markus Ruggiero
> [email protected]
> Check out the new book about Project Wonder and WebObjects on 
> http://learningthewonders.com/
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/atze%40freeport.de
> 
> This email sent to [email protected]


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

This email sent to [email protected]

Reply via email to