Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

show expression according to variable (or field value)

Hello

I have a graph and i need to show expression according to the choice of the user buttons and list are possibilities but is there another way to do that?

Thanks in advance

4 Replies
jagan
Luminary Alumni
Luminary Alumni


Hi,

Try like this

Expression :

If(variableValue = 1, Expression1, If(variableValue = 2, Expression2, .............................))

or

Pick(variableValue, Expression1, Expression2, Expression3)

Label :  If(variableValue = 1, Caption1, If(variableValue = 2, Caption2, .............................))

If you are using Qlikview 11, you can show/hide an expression based on the condition

Chart Properties -> Expression -> Select Condition and Put your condition there in textbox

Hope this helps you.

Regards,

Jagan.

p_verkooijen
Partner - Specialist
Partner - Specialist

From the QV helpfile:

getcurrentfield (GroupName)

Returns the name of the currently active field in a group.

Example

getcurrentfield( myGroup )

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

Returns a string with the current selections in a field.

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.

Examples

getfieldselections ( Year )

getfieldselections ( Year, '; ' )

getfieldselections ( Year, '; ' , 10 )

getcurrentselections ([RecordSep [, TagSep [,ValueSep [, MaxValues]]]])

Returns a string with the current selections in the document.

RecordSep is the separator to be put between field
records. The default is <CR><LF>.

TagSep is the separator to be put between the field
name tag and the field values. The default is ': '.

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.

Examples

getcurrentselections ( )

getcurrentselections ( chr(13)&chr(10) , ' = ' )

getcurrentselections ( chr(13)&chr(10) , ' : ' , ' ; ' )

getcurrentselections ( chr(13)&chr(10) , ' : ' , ' ; ' , 10
)

getselectedcount (FieldName [,
IncludeExcluded]
)

Returns the current number of selected values in a field.

If IncludeExcluded is true the count will include
selected values, which are currently excluded by selections in other fields. If
false or omitted these values will not be included.

Examples

getselectedcount ( Year )

getselectedcount ( Year, true( ) )

getnotselectedcount ( FieldName [,
IncludeExcluded]
)

Returns the current number of not-selected values in a field in a field with
AND-Mode in List
Boxes
(red values in list box).

If IncludeExcluded is true the count will include
selected values, which are currently excluded by selections in other fields. If
false or omitted these values will not be included.

Examples

getnotselectedcount ( Year ) 

getnotselectedcount (Year,true())

getpossiblecount (FieldName)

Returns the current number of possible values in a field.

Example

getpossiblecount ( Year )

getexcludedcount (FieldName)

Returns the current number of excluded values in a field.

Example

getexcludedcount ( Year )

getalternativecount (FieldName)

Returns the current number of alternative values in a field.

Example

getalternativecount ( Year )

saumyashah90
Specialist
Specialist

You can define a variable

say vVar=1(this will become 1 only when button is pressed)

In expression tick enable and give a condition for a particular expression that

if(vVar=1,your expression);

sushil353
Master II
Master II

hi,

You can hide your expression conditionally according to the action of your button.

In the expression tab write your condition in conditional box.

HTH

Sushil