Field functions return information about the field selections in the app.

This article will cover the basic principles of working with field functions in visualisations, including:

  • The general function syntax
  • Working with field functions in visualisations

For a complete, up-to-date list of field functions, please see the Qlik Sense help pages here.

The field function syntax

The general function syntax varies depending on the function. In this section, we will use an example function and decipher its syntax. This understanding will then help you read the syntax of other functions.

Example: GetFieldSelections

The GetFieldSelections() function returns selections made in the specified field.

GetFieldSelections (field_name [, value_sep [, max_values [, state_name]]])

The rules for reading the function syntax are as follows:

  1. The function name itself is first and all the parameters you need to enter go between brackets: ().
  2. The various elements you will need to enter are separated by commas. In this function, the elements to enter are:
    • field_name -> the name of the field in which you want to check the selections.
    • [value_sep] -> which character to use to separate multiple values. By default ‘,’ is used.
    • [max_values] -> the maximum number of values to return. The default is 6.
    • [state_name] -> if you want to check the field selections in a specific, non-default state, enter the state name inside single quotes.
  3. Anything between square brackets [] is an optional parameter. In this function, there are three optional parameters.

An example of this function being used to return a list of customer names filtered by would be:

GetFieldSelections([Customer Name])

How to use field functions in visualisations

Here are some important points on using field functions in visualisations:

  • All functions can be used within dimensions or measures depending on your need.
  • The functions can be nested and combined with other types of functions.

Here is an example of using the GetFieldSelections() function to create a note in the sheet showing the users which customer they have selected. The expression used:

GetFieldSelections([Customer Name])

Using the ‘Text & image’ visualisation, we can enter the text ‘Customer selected: ‘ followed by the above function to get: