Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
After setting up list boxes with alternate groups I now want to call the selections in a chart expression.
my code is:
Sum({$<{[OHRO]}[MARKET RISK: NOTE: on target + overdue = LIVE ISSUES]={'Red Threshold'},Getselectedfield from {[OHRO]}[Group]>}Data)
But I cant figure the item in red?
How do I 'getselectedfield'
Neil
By Group you mean Cycle or DrillDown Group?? Not sure what you mean because there is no function called GetSelectedField. There are few like GetCurrentField(), which is used with Cycle or DrillDown Group, but based on your question, you may need something else.
Hi Neil,
If you're talking about using the GetFieldSelections() function within a search string inside set analysis, the ability to define which state you want to reference was added for SR9 or 10 I believe.
You can use GetFieldSelections([Your Field], [Your value separator], [State]).
However, looking at your expression, you may want to use the element function P() instead - or use the $:: function to synchronise your selections between states.
If you look up 'examples of alternate states in chart expressions' in Qlikview Help it has a fuller explanation.
Hi there,
I am using QV11 with alternate states, it looks like GetCurrentField() and getfieldselections does not work on charts with alternate states?
Thanks.
Hi I thought the code was
GetfieldSelections([Your field],[You Value seperator],[Maxvalues])
That is what my help file is saying, is there any online help topics for this?
GetFieldSelections() has a parameter for State, Helptext pasted in below.
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 ![]() |
'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 )
Maybe I dont have the right version as this errors.
My version is 11.20.12577.0 SR8
Sum({[OHRO]<[MARKET RISK: NOTE: on target + overdue = LIVE ISSUES]={'Amber Threshold'},getfieldselections([Group],';',10,OHRO)>}Data)
Hi Neil,
SR8 was the first version to include this function, so you should be able to use it. I believe the help wasn't updated until SR9 or SR10 to include this, but in the release notes it states you can do this from SR8.
Note that the state needs to be written in quotation marks.
Just referencing your expression, you haven't got anything preceding your GetFieldSelections expression, so at the minute I don't think this will be working correctly. If you want to filter on the "Group" field based on the selections of another state, you may be better off using:
Sum({[OHRO]<[MARKET RISK: NOTE: on target + overdue = LIVE ISSUES]={'Amber Threshold'}, Group=OHRO::Group>}Data)
Which would synchronise your selections in the field Group from the state OHRO with your equation. You can also use:
Group=P({OHRO}Group>}Data) which will pass any possible values to the other state, so it's not just a selection in the field group that would affect the result, but any selection in that state that narrows the possible values in the field group.
If you wanted to use the GetFieldSelections function you'd need to turn this into a search string, and also convert the values it returns into a valid selection set.
I would just like some direction on the below statements:
Sum({[OHRO]<[ABC]={'Amber Threshold'}, Group=OHRO::Group>}Data).
Even though you synchronise your selections in the field Group from the state OHRO, it only matters in the above equation what you select on in OHRO group state, so what is really inherited if selections in the higher level group if that group has selections or not?
In the below statement I can't see what is going on:
Sum({[OHRL]<[ABC]={'OPEN-High-Live'},Group=P({OHRL}Group>}Data)
If I select the higher group,ABC or Group and selections in OHRL, the selections turn green but nothing charts, so I cant see what is going on with the P function.
I thought what ever you select in P({OHRL}Group will chart if OPEN-High-Live is selected in [OHRL]
Thanks