S
S
SheetDream
Search…
Advanced Queries
Queries allow you to filter your data according to some specific criteria.
Queries in SheetDream follow a simple syntax, and let you run comparisons and boolean operations against fields within any table.
Here is an example of a query that checks for a field being equal to a specific value:
https://api.plutodream.com/sheetdream/api/:your_project:/restaurantmenu?query=eq(Price, 12.99)
Operations can also be chained together with and / or:
https://api.plutodream.com/sheetdream/api/:your_project:/restaurantmenu?query=eq(Price, 12.99) and contains(Description, "beef")
Parenthesis are also honored, much like you would see in a mathematical expression:
https://api.plutodream.com/sheetdream/api/:your_project:/restaurantmenu?query=(gte(Price, 6) and lte(Price, 15)) and contains(Description, "beef")
This sort of functionality can be used to build complex queries against your data, and advanced searching functionality.
Functions are the building blocks of these query expressions (eq, lte, gte, contains above). SheetDream maintains consistency of function naming for these query expressions, as well as the kind of expressions you can utilize on the client side with our Handlebars.js Extensions (seen here). This helps considerably in rapidly creating apps.

Available Functions

Here is a table of the available functions for you to use in building out your query expressions, what they do, and their signature (what parameters they expect you to pass).
Function Name
Parameters
Description
min
vals: number[]
Given an array of numbers, returns the minimum.
max
vals: number[]
Given an array of numbers, returns the maximum.
floor
val: number
Returns the floor of a particular number (e.g. 6.4 evaluates to 6)
ceil
val: number
Returns the ceiling of a particular number (e.g. 6.6 evaluates to 7)
pow
val: number, exp: number
Raises val to the exponent exp.
sqrt
val: number
Finds the square root of val
abs
val: number
Returns the absolute value of val
avg
vals: number[]
Given an array of numbers, returns the average
random
min: number, max: number
Generates a random number between min and max
gt
val1: number, val2: number
Evaluates to true if val1 > val2
lt
val1: number, val2: number
Evaluates to true if val1 < val2
gte
val1: number, val2: number
Evaluates to true if val1 >= val2
lte
val1: number, val2: number
Evaluates to true if val1 <= val2
eq
val1: any, val2: any
Evaluates to true if val1 = val2
neq
val1: any, val2: any
Evaluates to true if val1 != val2
and
bool1: boolean, bool2: boolean
Same as and operator. Evaluates to true if bool1 and bool2 are both true
or
bool1: boolean, bool2: boolean
Same as or operator. Evaluates to true if either bool1 or bool2 are true
mod
val1: number, val2: number
Returns the remainder from val1 divided by val2
multiply
val1: number, val2: number
Multiples val1 by val2
Copy link