Support Topics Documentation Slack YouTube Blog

DataQueryBuilder seems not to be working


(Lanre O.) #1

I have a table with a column named state.

When I try to use the following code on searching via the rest api, I get an error:

DataQueryBuilder dataQuery = DataQueryBuilder.create();
dataQuery.setWhereClause(String.format(“state = %s”, state));
dataQuery.build();
List dataIWant = Backendless.Data.of(E.class).find(dataQuery);

400 - Column ‘PA’ does not exist in table ‘TABLE_NAME’ (1054)

What am I doing wrong?


(Mark Piller) #2

Hello,

I suspect the data type of the state column is String. As a result, the value in your whereaclause must be surrounded by single quotes:

state = 'PA'

Hope this helps.

Mark