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.

Removed: queryArray, queryColumns and queryJson

PocketQuery.queryArray(), PocketQuery.queryColumns() and PocketQuery.queryJson() have been removed and no longer return your Query result.

Templates that still call them keep rendering — the functions return empty values instead of causing an error — but they no longer provide any data:

Name

Returns

PocketQuery.queryArray()

[]

PocketQuery.queryColumns()

[]

PocketQuery.queryJson()

"{}"

If you enable debug mode on the PocketQuery macro, the Debug Information panel’s Execution Logs contain a hint whenever a Template uses one of these functions.

What to use instead

Render your Query result directly in the Template with Velocity, using $result (and $PQ.toList($result) to turn it into a list). See Velocity API Available in Templates.

Charts

The PocketQuery.chart API is not affected. It reads your Query result internally and never depended on the removed functions, so existing charts keep working. Check out its documentation here.

JavaScript in Templates

For security reasons, only PocketQuery and Date are available as global variables inside a Template’s <script>-tag. If a Template uses any other global (for example document, JSON or console), it is not rendered and a message is shown instead. See https://go.livelyapps.com/pq-globals.