Skip to main content

Celonis Product Documentation

Using the PQL editor

The PQL editor enables you to translate process-related business questions into queries, which are then executed by a custom-built query engine. This editor can now be accessed directly from your View layout builder, helping you create detailed Views with your data.

PQL_editor_overview.png

For more information about PQL, see: PQL - Process Query Language

 
Accessing the PQL editor from a View component

You can access the PQL editor using View components where data fields can be selected by either clicking the PQL editor button directly or when adding data to a setting (such as a table column):

access_PQL_editor.png
PQL editor enhanced options

When using the PQL editor, you have the following enhanced options:

To assist you when writing PQL expressions, an interactive PQL reference library is available within the editor.

Click PQL Ref to browse the references and then click the syntax to add it to the current line in the editor.

PQL_reference_library.png

You can also access inline PQL suggestions using CTRL + SPACE within the editor:

inline_suggestions.png

The data and variables displayed in the PQL editor are imported from Knowledge Models and package variables within the same package. They can be added to the PQL editor by clicking on them (adding them without any transformations) or you can click the + icon to apply aggregate functions to the data added.

The aggregate functions include: count, count distinct, min., max., and median.

add_data_to_pql_editor.png

When using the editor to create or edit PQL expressions, you are prompted to save the result as a metric to your knowledge model. This allows the metric to then be used and referenced in other assets using that knowledge model.

To save a metric to your Knowledge Model from within the editor, click Save to:

save_as_metric_to_knowledge_model.png

You're then in Knowledge Edit Mode, giving you the ability to edit the metadata associated with the new metric and, if necessary, the option to further edit the PQL expression.

Note that the new metric must have an ID before it can be saved and added to the Knowledge Model.

knowledge_edit_mode.png

You can now execute PQL queries and see the live results within the table whenever changes are made.

Click Run PQL when prompted or use the keyboard shortcut CTRL + ENTER.

run_PQL_refresh.png

After executing the query, either the table will update with the results or you will be shown a PQL error message with further information.

In this example, there is a syntax error in line 1.

PQL_error.png

Click the filters icon to quickly filter your content based on data types and sources. You can also use this feature to manage how your data is sorted.

quick_filters.png

When using custom formatting, a cheat sheet displays the options you have available for that data type: (also copied below):

custom_formatting_cheat_sheet.png
Number formats

Number formatting uses the d3 Number format. You can use the following rules in your formula:

The format specifier is modeled after Python 3.1's built-in format specification mini-language. The general form of a specifier is:

[fill][align][sign][symbol][width][,][.precision][type]

The available type values are:

  • Exponent ("e") - Uses Number.toExponential.

  • General ("g") - Uses Number.toPrecision.

  • Fixed ("f") - Uses Number.toFixed.

  • integer ("d") - Uses Number.toString.

  • rounded ("r") - round to [.precision] significant digits, padding with zeroes where necessary in similar fashion to fixed ("f"). If no precision is specified, falls back to general notation.

  • Percentage ("%") - like fixed, but multiply by 100 and suffix with "%".

  • rounded percentage ("p") - like percentage, but rounded "%".

  • binary ("b") - Displays the number in base 2.

  • octal ("o") - Displays the number in base 8.

  • hexadecimal ("x") - Displays the number in base 16, using lower-case letters for the digits above 9.

  • hexadecimal ("X") - Displays the number in base 16, using upper-case letters for the digits above 9.

  • character ("c") - Converts the integer to the corresponding unicode character before printing.

  • SI prefix ("s") - like rounded, but with a unit suffixed such as "9.5M" for mega, or "1.00µ" for micro.

The type "n" is also supported as shorthand for ",g".

The [fill] can be:

Any character other than "{" or "}". The presence of a [fill] character is signaled by the character following it, which must be one of the align options.

The alignment can be:

  • ("<") Aligned left.

  • (">") Aligned right (default)

  • ("^") Central alignment

The prefix can be:

  • plus ("+") - a sign should be used for both positive and negative numbers.

  • minus ("-") - a sign should be used for both positive and negative numbers.

  • space (" ") - a leading space should be used on positive numbers and a minus sign on negative numbers.

The symbol can be:

  • currency ("$")

  • base ("#") - for binary, octal, or hexadecimal output, prefix by "0b", "0o", or "0x", respectively.

  • The "0" option enables zero-padding.

The width defines the minimum field width. If not specified, then the width will be determined by the content.

The comma (",") option enables the use of a comma for a thousands separator.

The precision indicates how many digits should be displayed after the decimal point for a value formatted with types "f" and "%", or before and after the decimal point for a value formatted with types "g", "r" and "p".

Date formats

Date formatting uses the D3 Time Format. You can use the following rules in your formula:

  • %a - abbreviated weekday name.

  • %A - full weekday name.

  • %b - abbreviated month name.

  • %B - full month name.

  • %c - date and time, as "%a %b %e %H:%M:%S %Y".

  • %d - zero-padded day of the month as a decimal number [01,31].

  • %e - space-padded day of the month as a decimal number [ 1,31]; equivalent to %_d.

  • %H -hour (24-hour clock) as a decimal number [00,23].

  • %I -hour (12-hour clock) as a decimal number [01,12].

  • %j - day of the year as a decimal number [001,366].

  • %m - month as a decimal number [01,12].

  • %M - minute as a decimal number [00,59].

  • %L - milliseconds as a decimal number [000, 999].

  • %p - either AM or PM.%S - second as a decimal number [00,61].

  • %U - week number of the year (Sunday as the first day of the week) as a decimal number [00,53].

  • %w - weekday as a decimal number [0(Sunday),6].

  • %W - week number of the year (Monday as the first day of the week) as a decimal number [00,53].

  • %x - date, as "%m/%d/%Y".%X - Time as "%H:%M:%S".

  • %y - year without century as a decimal number [00,99].

  • %Y - year with century as a decimal number.%Z - time zone offset, such as "-0700".%% - a literal "%" character.