ask about query

I want to make multiple clauses I mean
I have a table User which has column name ,blood_type ,city,gender
I want to make clauses for both blood_type and city together
I try to add each where clauses separately but it give me wrong clauses result
String bloodSearch = “donor_blood_group = “+”’”+donorBloodGroup+"’";
String city= “city = “+”’”+city+"’";

it give me the result of all city that contain donor_blood_group
not the specific city I determined

and I try but the both in one clauses

String cityBloodTypeSearch = "city = "+"\'"+city+"\'"+" , donor_blood_group = "+"\'"+donorBloodGroup+"\'";it give me error 

sorry for long questions
and thanks for help

Hi Ahmed.

Please, provide error message which you receive
in this request:

String cityBloodTypeSearch = "city = "+"\'"+city+"\'"+" , donor_blood_group = "+"\'"+donorBloodGroup+"\'";

Regards,
Kate.

thanks for reply
Here is the logcat and the exception of backendless
04-08 06:44:23.222: E/AndroidRuntime(1353): Caused by: BackendlessException{ code: ‘1017’, message: ‘Invalid where clause’ }

04-08 06:44:23.222: E/AndroidRuntime(1353): at com.backendless.Invoker$SyncResponder.errorHandler(Invoker.java:132)

04-08 06:44:23.222: E/AndroidRuntime(1353): at com.backendless.core.responder.AdaptingResponder.handledAsFault(AdaptingResponder.java:120)
04-08 06:44:23.222: E/AndroidRuntime(1353): at com.backendless.core.responder.AdaptingResponder.responseHandler(AdaptingResponder.java:75)

04-08 06:44:23.222: E/AndroidRuntime(1353): at weborb.client.ioEngine.HttpIOEngine.processAMFResponse(HttpIOEngine.java:261)

04-08 06:44:23.222: E/AndroidRuntime(1353): at weborb.client.ioEngine.HttpIOEngine.send(HttpIOEngine.java:206)

04-08 06:44:23.222: E/AndroidRuntime(1353): at weborb.client.ioEngine.HttpIOEngine.invoke(HttpIOEngine.java:144)

04-08 06:44:23.222: E/AndroidRuntime(1353): at weborb.client.WeborbClient.invoke(WeborbClient.java:138)

04-08 06:44:23.222: E/AndroidRuntime(1353): at com.backendless.Invoker.invokeSync(Invoker.java:100)

04-08 06:44:23.222: E/AndroidRuntime(1353): at com.backendless.Persistence.find(Persistence.java:560)

04-08 06:44:23.222: E/AndroidRuntime(1353): at com.backendless.DataStoreFactory$1.find(DataStoreFactory.java:162)

04-08 06:44:23.222: E/AndroidRuntime(1353): at com.asvin.blood_donor.SearchBloodDonor$load.doInBackground(SearchBloodDonor.java:298)

Hi, Ahmed,

I think the problem is that you use comma instead of the keyword AND. Try this:

String cityBloodTypeSearch = "city = "+"\'"+city+"\'"+" AND donor_blood_group = "+"\'"+donorBloodGroup+"\'";

thanks it work now thanks a lot

new Thread(new Runnable() {
public void run() {
String whereClause = “fieldId =”+imageTablesList.get(position).getObjectId();
BackendlessDataQuery dataQuery = new BackendlessDataQuery();
dataQuery.setWhereClause(whereClause);
BackendlessCollection<CommentBean> result = Backendless.Persistence.of( CommentBean.class ).find( dataQuery );
for(CommentBean comment:result.getData()){
Log.e(“comm”,comment.getCmtFullText());
}
}
}).start();

Hello sir/mam,
is Above code right or wrong ? i have a table at backendless from which i am getting objectId of item and i stored it in the another table. on the basis of this objectId i want to fetch data using above where clause. But this code giving following exception : BackendlessException{ code: ‘1017’, message: ‘Invalid where clause’ }

If the “fieldId” property is a string, the value in the whereClause must be surrounded by single quotes:

String whereClause = “fieldId = '”+imageTablesList.get(position).getObjectId() + “’”;

yes sir, it is String property. now i am able to fetch data.

Thank You Sir…