General
Query result
|
The variable To learn more about result formatting, refer to Writing Your Own PocketQuery Templates and Writing Your Own PocketQuery Converters. Example Result passed from Converter
Template HTML
Result
|
Query Parameters
|
Allows you to access the parameter values passed to your Query. If your Query statement makes use of wildcards, you can also find their values in this Map. Example Query Statement
Template
Result
|
Template insertion by Template ID
templateId: string |
Renders another Template inside the caller Template. It requires a Template ID, which is a unique identifier of the template you want to parse (you can obtain it in the Template administration). You can call Warning: For each Query execution, Example Template 1 (main) HTML
Template 2 (called)
Result
|
Macro execution
queryId: string
|
Executes another Query (including its Converter and Template) and returns the rendered result (as a Velocity template code). If you are looking to just get the raw result of another Query, use It requires 1 parameter: queryId, which is the ID of the Query to be executed (it can be obtained in the Query administration). The second argument is required in the case where the executed Query contains parameters. In that case, these parameters must be provided. Example HTML
|
Query execution
queryId: string
|
Executes another Query and returns the result (without applying Converter or Template). This allows you to work with the result of another Query within your Template. If you are looking to directly render another Query, use It requires 1 parameter: queryId, which is the ID of the Query to be executed (it can be obtained in the Query administration). The second argument is required in the case where the executed Query contains parameters. In that case, these parameters must be provided. Example HTML
|
Locale (localization)
languageKey: string
|
Returns a ‘Locale’ (an object containing localization details) based on required country and language. This object is required for some other helpers to adjust their results to your location and language. It requires 1 parameter: language key. If you want to be more specific (suitable for english-speaking countries), you can also optionally provide country key parameter. The languageKey parameter refers to language identifier according to RFC-4646/4647.
Example HTML
Result
|
Random UUID
|
Generates a random UUID String that can be used to create a unique identifier within a Template.
|
Date/Time Formatting
Format date and time
timezone: string
|
Formats a date (as Unix Timestamp) into a human-readable format. It accepts 2 parameters: timestamp, date format, and optionally timezone.
Example HTML
Result
|
Parse date and time
timezone: string
|
Converts a string representation of a date into a Unix Timestamp. It requires 2 parameters: string representation of date, date format, and optionally timezone. The date parameter is a date in string format.
Example HTML
Result
|
Localized calendar
locale: localization
|
Returns a new localized java.util.calendar instance. It requires 2 parameters: localization and timezone. The locale parameter is a Locale object described above.
Example HTML
Result
|
Text and Currency Formatting
Currency formatter
locale: localization
|
Formats a number as a currency. It requires 2 parameters: localization and amount. The locale parameter is a Locale object described above.
Example HTML
Result
|
Markdown formatter
markdownText: string |
Formats Markdown text into HTML. 1 parameter is required: the Markdown text to be formatted. Example HTML
Result (user sees rendered markup) HTML
|
Collection Operations
New List
items: enumeration (optional) |
Creates a new list of items. It accepts an enumeration of list items. The number of items is not limited. On the returned list, you can call standard Java lists methods. Example HTML
Result
|
New list of unique items (Set)
items: enumeration (optional) |
Creates a new set of items. A set is a special type of list, containing only unique items. It accepts an enumeration of list items. The number of items is not limited. On the returned set, you can call standard Java lists methods. Example HTML
Result
|
New Map
|
Creates an empty map. A map is a collection of key:value attributes (such as a JSON object) called entries. You can use it to create custom objects in the Velocity template. On the created map, you can call standard Java methods. Example HTML
Result
|
Object to flat list
object: object |
Creates a List out of any Object, flattening nested objects inside. The Default Template uses this function to make a list out of the result. This allows the result to always be displayed as a table, no matter how complex it is. Example HTML
Result
|
Object flattening
object: object |
Flattens an object. Nested object's parameters are appended to the parent object’s keys. Example HTML
Result
|
Make list items unique
list: list |
Converts a collection (list/set/array) to a set (a list containing unique items only). Example HTML
Result
|
Sort list
list: list
|
Sorts the provided list so its items are in an ascending oder. There are two ways to sort the list. You can either use the default comparator (for non-structured items). If the list contains structures (objects/maps), you can sort them using some particular parameter. Example HTML
Result
|
Reverse list
list: list
|
Reverses the order of items in the provided list. Example HTML
Result
|
Java Utils
PocketQuery provides some standard Java Utils. You can use them as standard Java objects and call their methods to format and convert your query results. Note that these utils are not available under the $PQ or $PocketQuery namespace, but under the global namespace..
Date (java.util)
|
Returns a new java.util.Date instance. You can call Example HTML
Result
|
Number tool (org.apache.velocity.tools.generic)
|
Returns a new org.apache.velocity.tools.generic.NumberTool instance. The default currency formatting is euro. Navigate to Currency formatting to see other formatting options. Example HTML
Result
|
Math tool (org.apache.velocity.tools.generic)
|
Returns a new org.apache.velocity.tools.generic.MathTool instance. This instance can be use for basic mathematical operations, such as finding the average or maximum of some numbers. Example HTML
Result
|
Link tool (org.apache.velocity.tools.generic)
|
Returns a new org.apache.velocity.tools.generic.LinkTool instance. This tool helps you to build URLs. Example HTML
Result
|
Escape tool (org.apache.velocity.tools.generic)
|
Returns a new org.apache.velocity.tools.generic.EscapeTool instance. This tool helps render tags and code snippets correctly. Example HTML
Result
|
Calendar (java.util)
|
Returns a new default java.util.calendar instance. The localization of the instance is default (CET). If you want to adjust the instance to your location, please, navigate to Localized calendar helper. Example HTML
Result
|