We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOther Libraries › Yahoo API query - Daniel Shiffman library
Page Index Toggle Pages: 1
Yahoo API query - Daniel Shiffman library (Read 656 times)
Yahoo API query - Daniel Shiffman library
Nov 4th, 2009, 3:46pm
 
Hi,

I am using the Daniel Shiffman Yahoo API. I am searching through an array of search terms using the following code in void setup:

Code:
 // YAHOO initialiser - Search for all names
for (int i = 0; i < names.length; i++) {
// The search() function is called for each name in the array.
yahoo.search(names[i]);



Then I am using 3 switch cases to target the total results for each search term separately using the following code:

Code:
void searchEvent(YahooSearch yahoo) {


int total = yahoo.getTotalResultsAvailable();

switch(searchCount)
{
case 0:

r = (total)/35;
println (r);

//
CODE THAT USES r value here
//


r=0;

searchCount++;
break;


case 1:


r = (total)/35;
println (r);

//
CODE THAT USES r value here
//


r=0;
searchCount++;
break;



case 2:


r = (total)/35;
println (r);
//
CODE THAT USES r value here
//

r=0;

default:

searchCount = 0;
break;
}


The search results retrieved seem to be stable i.e. the same each time - but they seem to shift between each case. i.e. I don't get the same search result each time. Is there something I am doing wrong in each switch case? Also I am using a timer between switches and so if this was too short a time then could it accidentally skip over a case?

Let me know if you need the entire code to understand my query?

Thank you
Page Index Toggle Pages: 1