On May 3, 2010, at 5:38 PM, Baiss Eric Magnusson wrote:

I have an Owner, the Owner has many Transactions.

I need an ERXBatchingDisplayGroup<Transaction> of all the Owner's Transactions between two dates.

The <matchDates> fetch spec of the Display Group <curTrans> is

        date >= $startMonth and date < $endMonth

In the pages Constructor I used:
...
        public ERXBatchingDisplayGroup<Transaction> curTrans;
...
        curTrans.queryBindings().setObjectForKey( … );
        try  {                  
                curTrans.setObjectArray( theOwner.transactions() );
                curTrans.qualifyDataSource();

That looks... odd. Especially this part: curTrans.setObjectArray( theOwner.transactions() ) I'd expect to set ERXBatchingDisplayGroup up for Transaction and use a qualifier like "owner = $owner and date >= $startMonth and date < $endMonth" Passing in theOwner.transactions() is likely to remove a lot of the benefit.


I don't use model (or wherever you are getting this from) display groups, so I don't know what do tell you. In code it would look something like this:


dataSource = new EODatabaseDataSource(editingContext(), entityName());

dataSource .fetchSpecification ().setPrefetchingRelationshipKeyPaths (prefetchingRelationshipKeyPaths()); dataSource .fetchSpecification ().setRefreshesRefetchedObjects( refreshesRefetchedObjects() );
            dataSource.fetchSpecification().setIsDeep( true );
dataSource().fetchSpecification().setQualifier(qualifier());
            displayGroup.setDataSource(dataSource);



If I look at <theOwner.transactions().count()> before the crash there's a number of them, probably faults?

Crash? You did not mention a crash before. I am guessing you mean an exception not a crash. What is the stack trace?


What do I need to do to set the data source, I thought that <setObjectArray> was the way to do it, but no, it always crashes?


I've sketched out what I do, but I lifted that from other pieces of code, so it is only a rough sketch.


Chuck


--
Chuck Hill             Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects







_______________________________________________
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