Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
If I have a field named "EmployeeName", and I want to select from a list box a few values from this field ,
how can i know after each selection the value i have just selected?
Say i select Adam - so I want to get the name Adam into a variable,
then I select Jim, so I would like that Jim will go into the variable, and so on... I always want to know the last value i have just selected.
Thanks,
Guy
Hi,
I was a bit disappointed to find out Qlikview doesn't have the ability to get the last selected value...
Anyway, I succeeded doing it myself.
What i wanted is that If I choose multilply values from the "_Dynamic_Expressions:" field , I'll get the last selected value and not all the selected values.
The magic happens like this (see also the attched QVW):
=concat( if(index('$(vLastSelectionOfDynamicExp)',subfield(getfieldselections(_Dynamic_Expressions,',',vDynamicCount),',',ValueLoop(1,vFieldDymanicCount,1)))>0
,NULL(),subfield(getfieldselections(_Dynamic_Expressions,',',vDynamicCount),',',ValueLoop(1,vFieldDymanicCount,1))),'')
when vLastSelectionOfDynamicExp = Concat({$1} _Dynamic_Expressions, ',') : that means the previous selection of _Dynamic_Expressions,
so practically the concat concatenates only values that were not in the last selection, that means the last new selected value ...
I know its hard to understend this code, but take a look at the file attached, it might help.
Yours,
Guy
Have you tried with =GetFieldSelections([Employee Name])
You can assign this into your variable. Or if you will select always one value in the Employee Name ListBox, you can set 'Always One Selected Value'.
take the text box
=GetFieldSelections([Employee Name])
previous([Employee Name])
Using the set analysis identifiers, $ = current selection, $1 = previous selection
Concat({$} EmployeeName, ',') -- current selection
Concat({$1} EmployeeName, ',') -- previous selection
You could display both, or you could feed this into a macro to identify the changes.
Hi,
I was a bit disappointed to find out Qlikview doesn't have the ability to get the last selected value...
Anyway, I succeeded doing it myself.
What i wanted is that If I choose multilply values from the "_Dynamic_Expressions:" field , I'll get the last selected value and not all the selected values.
The magic happens like this (see also the attched QVW):
=concat( if(index('$(vLastSelectionOfDynamicExp)',subfield(getfieldselections(_Dynamic_Expressions,',',vDynamicCount),',',ValueLoop(1,vFieldDymanicCount,1)))>0
,NULL(),subfield(getfieldselections(_Dynamic_Expressions,',',vDynamicCount),',',ValueLoop(1,vFieldDymanicCount,1))),'')
when vLastSelectionOfDynamicExp = Concat({$1} _Dynamic_Expressions, ',') : that means the previous selection of _Dynamic_Expressions,
so practically the concat concatenates only values that were not in the last selection, that means the last new selected value ...
I know its hard to understend this code, but take a look at the file attached, it might help.
Yours,
Guy