TIMEQUERY
Used to query values stored by TIMESTORE. The result can be saved to a specified TargetRange or used as an input for charts.
Syntax
=TIMEQUERY(TimestoreCell, Query, [Interval], [TargetRange], [Limit])
Arguments
Name | Description | |||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
TimestoreCell | A reference to the timestore cell on which the query should be executed. | |||||||||||||||||||||||||||||||||||||||||
Query | A JSON object which specifies the query to perform. See below for more information. A query consists of the following fields:
| |||||||||||||||||||||||||||||||||||||||||
Interval (optional) | An interval in seconds at which the query should be executed. Only values with a timestamp within given interval are used as query input. If no interval is specified the query is performed on each step. | |||||||||||||||||||||||||||||||||||||||||
TargetRange (optional) | A cell range to write the query result to. | |||||||||||||||||||||||||||||||||||||||||
Limit (optional) | Specifies the maximum number of results stored. If limit is reached the function returns a #LIMIT error. Defaults to 1000. |
Return
TRUE, if successful.
Examples
Query Source:
A | B | Description | |
---|---|---|---|
1 | select | v1 | JSON(A1:B3) |
2 | aggregate | sum | will sum up all values of v1 |
3 | where | v2 > 50 AND v1 < 100 | for entries with a v2 value greater 50 and a v1 value less 100 |
4 | |||
5 | select | v1, v2 | JSON(A5:B6) |
6 | aggregate | sum, max | will sum up v1 and determine maximum of v2 |
7 | |||
8 | select | * | JSON(A8:B10) |
9 | aggregate | avg | will calculate the average of all values |
10 | where | v1 > 30 | for entries with a v1 value greater 30 |
Formula | Result | Comment |
---|---|---|
| Queries the total values for v1 on each step | |
| Queries the total for v1 and the maximum of v2 every 10 seconds | |
| Simply writes all stored values to target range on each step |
TIMEQUERY(F19,JSON(G21:H21),,A16:D39,) A query to gather all information (G21:H21) from the TIMESTORE function (F19) and display them in a Target Range (A16:D39). Left image shows the query, right image shows the Target Range.