Find an Answer
PQL functions work very much like their counterparts in SQL.
The syntax for PQL functions is as follows:
return function(argument)
PQL supports the following functions:
| Function | Number of arguments | Description |
|---|---|---|
| abbreviate() | 3 | Limits the length of a string. |
| available_history() | 3 | Returns timestamps for which history is available. |
| child() | 2 | Returns the nth child node. |
| coalesce() | Any number | Returns the first argument from a list, that is not NULL. Equivalent to nvl. |
| count() | 1 | Returns the total number of items. |
| created_at() | Any number | Returns the date of creation. |
| date() | 2 | Converts the output to date format, such as 1970-01-01T00:00:00.604799Z. |
| downcase() | 1 | Converts all characters in a string to lower case. Equivalent to lower. |
| first() | 1 | Selects the first leaf in a tree, such as the first interface from /network/device. |
| float() | 2 | Converts the output to a floating number, such as 604799. |
| format() | 2 | Returns a number that is formatted to the specified number of decimal places, such as: 2008-01-20T23:16:15.899040Z. |
| has_history() | Any number | Indicates whether or not a node contains history information. |
| history() | Any number | Returns a list of previous values over time, if the leaf node had more than one value in the past. |
| id() | 1 | Returns the unique ID of the node. Every node, sub-node, and leaf node have a unique identifing number which this function returns. |
| int() | 2 | Converts the output to int format, such as 604799. |
| integer() | 2 | Converts the output to an integer, such as 604799. |
| join() | 2 | Traverses a tree and concatenates all values with a provided string, or selects data from two or more paths and joins the data to make the result complete. |
| lower() | 1 | Returns all characters in a string in lower case. Equivalent to downcase. |
| max() | 1 | Returns the maximum value. |
| mean() | 1 | Returns the mean value. |
| min() | 1 | Returns the minimum value. |
| num_children() | 1 | Returns the number of child nodes. |
| nvl() | Any number | Returns the first argument from a list, that is not NULL. Equivalent to coalesce. |
| observed_at() | Any number | Returns the date the node was last observed. |
| parent() | Any number | Returns the parent node. |
| path() | 1 | Returns the path to a node. |
| raw_history() | Any number | Returns raw history samples without any bucketing. |
| string() | 2 | Converts the output to string format, such as 1970-01-01T00:00:00.604799Z. |
| substring() | 3 | Returns the first N characters of a string. |
| sum() | 1 | Returns the sum of a set of values. |
| time() | 2 | Converts the output to timestamp format, such as 1970-01-01T00:00:00.604799Z. |
| timestamp() | 2 | Converts the output to timestamp format, such as 1970-01-01T00:00:00.604799Z. |
| upcase() | 1 | Converts all characters in a string to upper case. Equivalent to upper. |
| upper() | 1 | Returns all characters in a string in upper case. Equivalent to upcase. |
| zip() | 2 | Combines 2 sets of historical data from unrelated parent nodes. |
Related topics