Re: WOBatchNavigationBar and qualifyDisplayGroup()

Lawrence Kendall <[email protected]>
Newsgroups gmane.comp.web.webobjects.newbies
Message-ID <[email protected]>
Cool!!!

I wouldn't worry about the count taking too long.  It would take way  
longer to actually fetch the objects than count them.  Although the  
count does take some time, it is pretty much negligible. In this  
example, using the variable won't save you any time either.  Since you  
only reference the variable once it only does the count once.  If you  
were referencing it 10 times then it would take longer, but you  
probably wouldn't notice it.  You can test this if you like by using  
the following code:

long startTime = System.currentTimeMillis();

//count code goes here

System.out.println("Process time:  
"+(System.currentTimeMillis()-startTime)/1000f);

This will give you a System.out of the time it took to process the  
count in seconds.  You can use that when doing any sort of optimisation  
testing.

uummm, one batch hey??

hhmmm...

What is your repetition hooked up to??  You should have the list  
binding hooked up to productDetailDisplayGroup.displayedObjects to  
display the correct number of objects per batch.

Did you set numberOfObjectsPerBatch in the java or in the WO??  I  
prefer to set it in the java personally because I have found that  
setting it in WO can occasionally be flakey (although I sometimes have  
great success with it).  You set it in the java by calling  
productDetailDisplayGroup.setNumberOfObjectsPerBatch(25) in the  
constructor of your component (or you can call it just after you set  
the masterObject if you want to).  Not sure why you would see 13 unless  
you had set it to 13 somewhere.

See how that goes.

Larry.


On 22/02/2005, at 9:22 AM, Adam Rice wrote:

That worked a charm, thanks, but I¹ve obviously done something wrong.

  FoundObjects.count() gives me a true count but it is still only  
registering
  as one batch.

  What I have on screen, as an example, is a search result saying:
      ³182 Products² where 182 is an int representing  
foundObjects.count()
  (given that I¹m not that experienced, I was worried that count() would  
do a
  new count every time which would be slow for a large results list  
where as
  referencing a variable would be fast... Feel free to smack me down if  
I¹m
  incorrect), the ³s² in ³Products² is in a conditional where
  foundObjectsCount > 1
      productDetailDisplayGroup has numberOfObjectsPerBatch = 25 but I  
see 13
  results on screen.
      productDetailDisplayGroup.batchCount = 1
      productDetailDisplayGroup.hasMultipleBatches = false

  What on earth have I done? :)



  My code now reads:

  productDetailDisplayGroup.queryMatch().setObjectForKey("N",  
"product.obs");

  productDetailDisplayGroup.queryMatch().setObjectForKey("RES",  
"pricelevel");

  NSArray args = new NSArray(new Object[] { "IPOD", "SW", "MON", "ACC"  
});

  String qualifierString = "(product.brand = %@)";

  EOQualifier qualifier =
  EOQualifier.qualifierWithQualifierFormat(qualifierString, args);

  EOFetchSpecification fs = new EOFetchSpecification("productDetail",
  qualifier, null);

  EOEditingContext ec = session().defaultEditingContext();

  NSArray tempResultsArray = ec.objectsWithFetchSpecification(fs);

  productDetailDisplayGroup.setObjectArray(tempResultsArray);

  productDetailDisplayGroup.qualifyDisplayGroup();

  foundObjects =
   
EOQualifier.filteredArrayWithQualifier(productDetailDisplayGroup.allObje 
cts(
  ), qualifier);

  foundObjectsCount=foundObjects.count();
         
  if(foundObjectsCount==0)
      resultsFound = false;
      else
      resultsFound = true;
  if(foundObjectsCount==1)
      oneResultFound = true;
      else
      oneResultFound = false;




Yahoo! Groups Links

	• 	To visit your group on the web, go to:
http://groups.yahoo.com/group/webobjects-newbies/
 
	• 	 To unsubscribe from this group, send an email to:
[email protected]
 
	• 	 Your use of Yahoo! Groups is subject to the Yahoo! Terms of  
Service.


------------------------------------
Lawrence Kendall
WebDesigner/Programmer

Automaton
35 Little Victoria Street
Fitzroy VIC 3065

P:	+61 3 8415 0007
M:	0400 00 11 03
E:	[email protected]
W:	www.automaton.com.au

------------------------------------
In 1945, a computer at Harvard University malfunctioned.  A dead moth  
was found in one of the circuit boards and was removed.  Ever since,  
whenever something goes wrong with a computer it is referred to as a  
"bug".


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/webobjects-newbies/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
image.tiff (image/tiff, 204 B) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.