GetFieldSelections - chart function

GetFieldSelections() returns a string with the current selections in a field.

If all but two, or all but one of the values are selected, the format 'NOT x,y' or 'NOT y' will be used respectively. If you select all values and the count of all values is greater than max_values, the text ALL will be returned.


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

Return data type: string


Arguments Description
field_name The field containing the range of data to be measured.
value_sep The separator to be put between field values. The default is ', '.

The maximum number of field values to be individually listed. When a larger number of values is selected, the format 'x of y values' will be used instead. The default is 6.


The name of an alternate state that has been chosen for the specific visualization. If the state_name argument is used, only the selections associated with the specified state name are taken into account.

For more information, see Using alternate states for comparative analysis.

Examples and results:  

The following example uses two fields loaded to different filter panes, one for First name name and one for Initials.

Examples Results

Given that John is selected in First name.

GetFieldSelections ([First name])


Given that John and Peter are selected.

GetFieldSelections ([First name])


Given that John and Peter are selected.

GetFieldSelections ([First name],'; ')

'John; Peter'

Given that John, Sue, Mark are selected in First name.

GetFieldSelections ([First name],';',2)

'NOT Jane;Peter', because the value 2 is stated as the value of the max_values argument. Otherwise, the result would have been John; Sue; Mark.

Data used in example:


LOAD * inline [

First name|Last name|Initials|Has cellphone



Mark|Carr|MC |No



Peter|Franc|PF|Yes ] (delimiter is '|');

Did this information help you?

Thanks for letting us know. Is there anything you'd like to tell us about this topic?

Can you tell us why it did not help you and how we can improve it?