Support Topics Documentation Slack YouTube Blog

whereClause syntax error

This one is working fine with one condition

String whereClause = Constants.TOKEN +" = " + App.getAppInstance().getIncomingOutgoingRideDetails().getInt(Constants.TOKEN , 0);

String whereClause = Constants.TOKEN +" = " +  App.getAppInstance().getIncomingOutgoingRideDetails().getInt(Constants.TOKEN , 0) +
                        " and " + Constants.RIDE_ACCEPTED_BY_CHAUFFEUR + " = 'true'";

But when I add 2 conditions the where clause is not working. I believe the problem is with the
" and " + Constants.RIDE_ACCEPTED_BY_CHAUFFEUR + " = 'true'";

As I am using real-time database and i am sure that value is true for the property RIDE_ACCEPTED_BY_CHAUFFEUR

I update the property named RIDE_ACCEPTED_BY_CHAUFFEUR and its updating to the true string then I am waiting for my live event listener to get invoke, there I insert the condition that TOKEN = some number and RIDE_ACCEPTED_BY_CHAUFFEUR = true but 2nd condition is not working and if I code only 1 condition I,e Token my listener is responding as I want.

Hello Saad,

did you try yout condition using REST Console (not real-time)?
Which error do you see there?


I am using Real-Time Database and followed all the steps as documentation suggest. When i use single condition i.e Token = 123 trigger event it is working fine but when i use 2 conditions the listener does not trigger

To verify your whereClause you can copy it (or replicate manually) and try to get records from DB directly in REST console here:

There you will see an error with description if your whereClause is wrong. Please try it and let us know your results.


Also if Constants.RIDE_ACCEPTED_BY_CHAUFFEUR is the name of your column, and column type is Boolean, then " = 'true'" should be without additional brackets, so just " = true"

Thank you for your time and response.

Yes, where clause is valid in the rest console.
I don’t understand why my listener do not work with the 2 conditions and is working fine with 1 condition.
I gotta figure out what I am doing wrong.

Plus i am using this
Backendless.Data.of( "PassengerChauffeurConnection" ).update(whereClause

to update field RIDE_ACCEPTED_BY_CHAUFFEUR to true and it is working as i can see it on console that the value is true. At this point my object is updated from false to true. Right after making it true i have a condition

  String whereClause = Constants.TOKEN +" = " +  token + " AND " + Constants.RIDE_ACCEPTED_BY_CHAUFFEUR + " = 'true'" ;
        EventHandler<PassengerChauffeurConnection> rtHandler = Backendless.Data.of(PassengerChauffeurConnection.class).rt();
        rtHandler.addBulkUpdateListener(whereClause, new AsyncCallback<BulkEvent>() {

this is not working.

Hi Saad,

What is the data type of the column represented by the Constants.RIDE_ACCEPTED_BY_CHAUFFEUR constant? Is it BOOLEAN ?