Skip to main content Skip to complementary content

GetFieldSelections

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.

Syntax:  

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

Return data type: string

Return string formats
Format Description
'a, b, c'

If the number of selected values is max_values or less, the string returned is a list of the selected values.

The values are separated with value_sep as delimiter.

'NOT a, b, c'

If the number of non-selected values is max_values or less, the string returned is a list of the non-selected values with NOT as a prefix.

The values are separated with value_sep as delimiter.

'x of y'

x = the number of selected values

y = the total number of values

This is returned when max_values < x < ( y - max_values).

'ALL' Returned if all values are selected.
'-' Returned if no value is selected.
<search string> If you have selected using search, the search string is returned.

Arguments:  

  • 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 ', '.
  • max_values: 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.
  • state_name: 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 Alternate States.

Examples

The following example uses the First name field loaded to a list box.

Example 1: John selected in First name

GetFieldSelections ([First name])

returns 'John'

Example 2: John and Peter selected in First name

GetFieldSelections ([First name])

returns 'John,Peter'

Example 3: John and Peter selected in First name

GetFieldSelections ([First name],'; ')

returns 'John; Peter'

Example 4: John, Sue, Mark selected in First name

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

returns '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:

Names:

LOAD * inline [

"First name"|"Last name"|Initials|"Has cellphone"

John|Anderson|JA|Yes

Sue|Brown|SB|Yes

Mark|Carr|MC |No

Peter|Devonshire|PD|No

Jane|Elliot|JE|Yes

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

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!

Join the Analytics Modernization Program

Remove banner from view

Modernize without compromising your valuable QlikView apps with the Analytics Modernization Program. Click here for more information or reach out: ampquestions@qlik.com