akhlaq.rao

Invalid operand to binary +

Discussion created by akhlaq.rao on Jul 14, 2010
Latest reply on Jul 16, 2010 by akhlaq.rao
Hi,

I am getting this invalid operand to binary error when I am trying to pass Parcel ID from a text box casted into an integer. Although, I do not need to convert its cast into integer, but I am not sure how can I compare searchBar.text value with "Title_Lookup" fieldAliases?

- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar
{
parcelsQuery = [AGSQuery query];
NSString *start = searchBar.text;
int startValue = [start integerValue];
parcelsQuery.where = @"Title_Lookup = '" +startValue+ "'";
parcelsQuery.outFields = [NSArray arrayWithObject:@"*"];
[parcelsQueryTask executeWithQuery:parcelsQuery];

[searchBar resignFirstResponder];
[AGSMapView showNetworkActivityIndicator:YES];
}

On the other hand this code (below) does not throw any exception nor the results?

- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar
{
parcelsQuery = [AGSQuery query];
parcelsQuery.where = @"Title_Lookup = 'searchBar.text'";
parcelsQuery.outFields = [NSArray arrayWithObject:@"*"];
[parcelsQueryTask executeWithQuery:parcelsQuery];

[searchBar resignFirstResponder];
[AGSMapView showNetworkActivityIndicator:YES];
}

Only this code (below) shows me the result, but I want to pass the Parcel ID dynamically right out of text box casted or without casted..any help will do it.
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar
{
parcelsQuery = [AGSQuery query];
parcelsQuery.where = @"Title_Lookup = '0022884928'";
parcelsQuery.outFields = [NSArray arrayWithObject:@"*"];
[parcelsQueryTask executeWithQuery:parcelsQuery];

[searchBar resignFirstResponder];
[AGSMapView showNetworkActivityIndicator:YES];
}

Akhlaq Rao
GeoSurfInc.

Outcomes