Hi again --
On Jul 14, 2005, at 5:12 PM, Sacha Mallais wrote:
WODisplayGroup.allObjects().count();
On Jul 14, 2005, at 5:17 PM, Ricardo Strausz wrote:
Isn't it displayGroup.allObjects().count()??
Wow, thank you both for replying so quickly!
Let me add some more context to better explain my issue:
Starting with a WODisplayGroup that is initialized via the WOO file, I call:
displayGroup.fetch();
This fetches about 350 objects from the database. In order to make the results more user friendly, I set numberOfObjectsPerBatch to 25 for my display group:
displayGroup.setNumberOfObjectsPerBatch( 25 );
When I then call:
displayGroup.queryMin().takeValueForKey( someTimestampInThePast, "dateCreated" );
displayGroup.qualifyDisplayGroup();
This trims down the list of objects to 60 objects (which makes 3 batches). I would like to display that number (60) somewhere on my page. However, these are the results I get:
displayGroup.allObjects().count() 350 (the total number of fetched objects)
displayGroup.displayedObjects().count() 25 (the number that fit on that page), or 10 (for the last page)
displayGroup.setNumberOfObjectsPerBatch(0);
displayGroup.displayedObjects().count() 60 (the number of qualified objects -- this is what I want)
I would like to be able to get the third value without temporarily setting numberOfObjectsPerBatch to 0, because that has the side effect of erasing the selectedObjects() and currentBatchIndex(). Thus, I am wondering if it's possible for me to access the WODisplayGroup's private variables to see if I can directly get the array of qualified objects.
On Jul 14, 2005, at 5:12 PM, Sacha Mallais wrote:
Does anyone know if it's possible to access an object's private variable?
Yes, it is.
Any sample code you can point me to?
--
Thanks again
Alex Johnson
|| | ||| || | ||| | | | || || |||
\\ SITE 9 \\ SITE9.COM \\ 312.670.8469 \\
Hi all --
Does anyone know if it's possible to access an object's private variable?
Specifically, I want to get at WODisplayGroup._displayedObjects so I can tell how many objects match the query settings. With batching turned on, displayedObjects() only returns the current batch of objects.
The only solution I've come up with so far is:
int pp = numberOfObjectsPerBatch();
int pg = currentBatchIndex();
NSArray sel = selectedObjects();
setNumberOfObjectsPerBatch(0);
countOfQualifiedObjects = new Integer( displayedObjects().count() );
setNumberOfObjectsPerBatch( pp );
setCurrentBatchIndex( pg );
setSelectedObjects( sel );
_______________________________________________
WebObjects-dev mailing list