Search code examples
google-app-maker

Query date range?


Trying to preform a date range query on a datasource example:

query.where = 'TransactionDate BETWEEN: StartDate AND EndDate';

This is what I get:

Unexpected input at ': StartDate AND EndDate'.
Error: Unexpected input at ': StartDate AND EndDate'. at datasources.

I was assuming this would work similarly to a MySQL query:

WHERE TransactionDate BETWEEN "2012-03-15" AND "2012-03-31";

Solution

  • In order to use real SQL query you need to go with Calculated SQL model. With query.where = ... you are setting App Maker's Query Builder expression that supports limited set of operations. I think your Query Builder expression will look similar to this:

    TransactionDate >= :StartDate AND TransactionDate <= :EndDate