discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gdl2, filtering objects for display group


From: Dirk Lattermann
Subject: gdl2, filtering objects for display group
Date: Thu, 20 Jan 2005 19:15:55 +0100
User-agent: Mutt/1.4i

Hello list,

I re-compiled my GNUstep installation (and even GCC, switching to
3.4.3) but still cannot debug gdl2, but anyhow...

I don't know if I do things as expected:
I have three entities, A, B and C. A has a one-to-many relationship
to B, and B has a one-to-many relationship to C. The entities all use
EOGenericRecords.

I have set up a EODatabaseDataSource for A and a EODetailDataSource
for B with corresponding EODisplayGroups and an
EOMasterDetailAssociation between the two. Displaying data from
these instances works ok, and I get to see the values of B that are
in relation to the selected value of A.

Now, I want to restrict the values of B to those that don't have
any related records in C.

1. Should I do this in restricting the EODetailDataSource or the
EODisplayGroup for B? (Are both possible?)

I tried restricting the EODisplayGroup for B in the following way:
I created a subclass of EOGenericRecord adding a method

-(int) numC

that returns the number of objects in the array containing the related
objects of C. I tested [[dgB selectedObject] valueForKey: @"numC"] and
it worked.

I then created an EOQualifier and qualified the display group:

qual = [EOQualifier qualifierWithQualifierFormat: @"numC > 0"];
[dgB setQualifier: qual];

When fetching data, I got 

NSUnknownKeyException: Unable to find value for key

I looked in EODisplayGroup which seems to use (unfortunately, I
cannot debug) filteredArrayUsingQualifier: on the allObjects array.
I now tried manually:

[[dgB allObjects] filteredArrayUsingQualifier: qual] and got

NSInvalidArgumentException: EOEntity(instance) does not recognize isEnabled

on stderr, the message
Exception occured while loading model: Unable to find value for key
appears some lines before.

2. Is it ok that the NSArray addition filteredArrayUsingQualifier:
needs an entity (which it apparently does)?

3. Can/should I add an object property numC to the entity so that it
can be properly queried? I failed because there is no corresponding
attribute/column in this entity resp. table.

4. How can I "qualify" the detail data source so that only the right
objects are fetched in the first place, without them needing to be
filtered later?

5. Is this the right approach to model such situations (those that
originate from queries "where not exists + subselect")?

I know this sounds a bit confusing, but I am still confused by some
(many? -- most??) aspects of gdl2, especially guessing how to use
its features is very hard when all you have is the class reference
(and the EOF developer's guide). This is also the reason for situations
like question 2 above where I'm too feeble-minded to submit a bug
report because I don't know if it's a bug or my incompetence.
If you tell me that some of these issues here are bugs, I will gladly
submit them as such :-)

Thank you in advance,
Dirk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]