JavaScript API Available in Templates
Inside your Templates, you can invoke JavaScript functions by making use of a <script>-tag. PocketQuery provides a global PocketQuery object that exposes some public API functions, making it easier to render your query results.
Charts
The PocketQuery.chart API can be used to render your Query results as charts. Check out its documentation here.
General
| Name | Return Type | Description | 
|---|---|---|
| PocketQuery.queryJson() | String | Returns the result of your Query in the form of JSON. This can be useful if you want to render the result of your Query completely yourself via JavaScript. Example Template Code: 
        JS
     Output: 
        CODE
      | 
| PocketQuery.queryColumns() | Array<String> | Returns a list of string that represents the column headers in a table, parsed from the Query result. Example Template Code: 
        CODE
     Output: 
        CODE
     If you have a messy result object that contains different columns in different rows, the result of  ‘Messy’ Result Data Example: 
        CODE
     ‘Messy’ Output: 
        CODE
      | 
| PocketQuery.queryArray() | Array<Object> | Returns the Query result as an array. Example Template Code: 
        CODE
     Output: 
        CODE
     On Server, the result of a Query always had to be an array. This changed in the Cloud version. Here, the result can be of any type. If your result is of any type other than  | 
