Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Partner
Partner

GetPossibleValues() - Help

Hi,

I have a piece of Macro which is used in a Button to select the PossibleValues for a Field/List Box. For example, data set is like this below:

 

IDRegion
100A
100B
100C
200D
200E
300F

  • When I Select ID = 100, the Possible Values for Region are A, B, C
  • The macro used to select the Possible Values is here and they are getting selected when a Button is used to call Macro.

SUB SelectValues

  SET Doc = ActiveDocument

  fieldName = "Region"

  'SET Field = Doc.Fields(fieldName).GetPossibleValues

  Doc.Fields(fieldName).SELECT "*"

end SUB

  • Now if I want to pass these Values to a Variable or see it in a Text Object using this expression -

        =Concat(GetFieldSelections(Key), ',')

I see a '*' , instead of A, B, C.

Requirement:

How can I see the values in a Variable or Text Object as A, B, C and NOT '*' ?

Is there any other way to pass the Possible Values from a List Box to Variable?


Please help.

Regards!

Tags (1)
1 Solution

Accepted Solutions
Partner
Partner

Re: GetPossibleValues() - Help

Hi,

try to use concat(distinct Region, ',') instead of GetFieldSelections.

Cheers,

Patric

View solution in original post

2 Replies
Partner
Partner

Re: GetPossibleValues() - Help

Hi,

try to use concat(distinct Region, ',') instead of GetFieldSelections.

Cheers,

Patric

View solution in original post

Employee
Employee

Re: GetPossibleValues() - Help

getfieldselections() can actually take a few more parameters including one that will define 'maxvalues'.

Try entering a larger number like this:

GetFieldSelections(Key,'',100)

You can also 2x check the user preferences->general->'max values for current selections' setting

---------------------------

getfieldselections ( FieldName [, ValueSep [, MaxValues [, State]]])

Returns a string with the current selections in a field. It is possible to query an alternate state.

ValueSep is the separator to be put between field values. The default is ', '.

Maxvalues 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.

State is the alternate state to query.

The string that is returned can be in these forms:

   

'x, y,z'If the number of selected values is Maxvalues or less, the string returned is a list of the selected values, separated with Valuesep as delimiter.
'NOT x, y, z'If the number of non-selected values is Maxvalues or less, the string returned is a list of the non-selected values, separated with ValueSep as delimiter, and NOT as a prefix.
'x of y'If the number of selected values is more than Maxvalues, but less than the total number of values (y) less Maxvalues.
'ALL'If all values are selected.
'-'If no value is selected.
<search string>If you have selected using search, the search string is returned.

Examples

getfieldselections ( Year )

getfieldselections ( Year, '; ' )

getfieldselections ( Year, '; ' , 10 )