Query Backendless

Hello Guys are always me … I explained why this quesry does not work ?? I always returns the same mistake that I had before, but I had changed all the code according to your advice … the error is:

12/20/2016 19: 13: 09,285 UNISTit [20630: 5124305] Server reported an error: FAULT = ‘1017’ [Invalid where clause: Abruzzo] <Invalid where clause: Abruzzo>

Tell me where I’m wrong because I’m going crazy … Until a few months ago everything worked …

#pragma mark - 

#pragma mark QUERY UNIVERISTY FROM DB 

-(void)retrieveUniversityListFromDb { 

UPPassData *passData = [UPPassData sharedInstance]; 



QueryOptions *option = [[QueryOptions alloc] init]; 

//option.sortBy = @[@"universita ASC"]; 

BackendlessDataQuery *query = [BackendlessDataQuery query]; 

query.queryOptions = option; 



NSString *escaped_region = [passData.signup_region stringByReplacingOccurrencesOfString:@"'" withString:@"''"]; 



query.whereClause = [NSString stringWithFormat:@"regione=`%@`", escaped_region]; 



[backendless.persistenceService find:[UPUniversity_DB class] dataQuery:query response:^(BackendlessCollection *universityList) { 



_universityArray = [universityList getCurrentPage]; 

NSLog(@" %@", _universityArray); 




[self.tableView reloadData]; 



} error:^(Fault *fault) { 

NSLog(@"Server reported an error: %@", fault); 



}]; 

}

Hi Fabio,

Try to change the quotes in the where clause string. Right now you use this:

`

see if you can change it to:

'

arrghhhhhhh!!! ahahahahh … you saved my soul bro!

Hi guys … having changed the query now addressed a problem with the emphasis in the text of my query … I had the same problem long ago but it worked properly with the old query … now that I have changed if I get no answers the array contains objects with emphasis
The problem is

NSString *escaped_region = [passData.signup_region stringByReplacingOccurrencesOfString:@"'" withString:@"''"]; 
 
 
 
query.whereClause = [NSString stringWithFormat:@"regione='%@'", escaped_region];


Hi Fabio,

Try testing your query first using Backendless Console as described at:
https://backendless.com/feature-14-sql-based-search-for-data-objects-using-console/

Regards,
Mark

mark Hello … My Problem And my question not only works on a single table but on two … A Contains All Regions and the Other All universities. With my question I was trying to compare universitaà What Are Present In University Table Containing The Region In the Regions table …

It seems everything work to perfection my only Problem And when I call the value “Valle d’Aosta” that contains an apostrophe and question them does not return anything … I came if she did not recognize the apostrophe

Anyway I tried to do as you said to me and gives me this error

regione =Valle d'Aosta

invalid where clause at position 16: mismatched input ‘d’ expecting { <EOF>,’.’, AND , OR }

Hi Fabio,

It looks like a regression in the system - escaping single quote does not work now. I will assign an engineer to look into it.

Regards,
Mark

Thanks Mark I await news Tues because in this moment I have my app stops for this Problem

Thanks a lot Please contact me WHEN managed to solve this problem

Normally problems like this cannot be resolved the same day. A development cycle requires every fix to go through testing, then deployment, so it will be at least a few days. As a workaround you can change the single quotes in objects to some other special character so that search queries go through.

unfortunately I need an apostrophe insert me asking how the Italian language would not make sense :slight_smile: Other Symbols … I wait of also few days … I beg you to inform me solo when succeed one Solve the Problem

No problem, we will notify you when it is fixed.

Hi Fabio,

The issue has been fixed. You can now use the following query:

regione='Valle d''Aosta'

Perfect Now Work !!! Thank you so much!!