New Plugin : problem with "Get information for selection" me

Any trouble you encounter with the Pedias, here's the place to ask for help.
Post Reply
bobino
Addicted to Bruji
Addicted to Bruji
Posts: 47
Joined: Tue May 26, 2009 4:23 pm

New Plugin : problem with "Get information for selection" me

Post by bobino »

Hi,

i'm writting a plugin for a online Database. The search plugin works very well.
But the "Get information for selection" in the "advanced" menu does nothing.

i can't find information on this menu, could someone help me ??

Thank you so much

Bobino
User avatar
Conor
Top Dog
Posts: 5345
Joined: Sat Jul 03, 2004 12:58 pm
Contact:

Re: New Plugin : problem with "Get information for selection" me

Post by Conor »

Hi Bobino,

When using the "Get information for selection" the entire record is sent to the plug-in, so the 'keyword' attribute is not filled and you have to pull out the preferred data from the records field that you would like to search on. The code in the "searchFor:sender:" method would be something like this:

Code: Select all

NSString *urlString= nil;
	
// This is the regular search from the keyword window.	
	if ([searchDict objectForKey:@"keyword"]) {
		urlString = [searchDict objectForKey:@"keyword"];
	}
// Otherwise it's a record and I want a specific field so I try the best ones first, like UPC that will give me a unique record.
	else if ([searchDict objectForKey:@"upc"]) {
		urlString = [searchDict objectForKey:@"upc"];
	}
	else if ([searchDict objectForKey:@"title"] && [searchDict objectForKey:@"director"]) {
		urlString = [NSString stringWithFormat:@"%@+%@", [searchDict objectForKey:@"title"], [searchDict objectForKey:@"director"]];
	}
	else if ([searchDict objectForKey:@"title"]) {
		urlString = [searchDict objectForKey:@"title"];
	}
	else if ([searchDict objectForKey:@"director"]) {
		urlString = [searchDict objectForKey:@"director"];
	}
	else {
		[sender searchReturnedNumberOfResults:0 sender:self];
	}
	
// Here you would continue with your regular code and run the search using urlString as the search keyword.
Hope that helps if you have any other questions don't hesitate to ask.
bobino
Addicted to Bruji
Addicted to Bruji
Posts: 47
Joined: Tue May 26, 2009 4:23 pm

Re: New Plugin : problem with "Get information for selection" me

Post by bobino »

perfect !!

thks
Post Reply