Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Stringvariable in set analysis


Hi,

i define a variable as: set vSC = 'GetFieldselections(Field)';

the field variables in Field are type string. The variable works and i can see in QV that its changing value (text object) when making selections in field.

i want to use this variable in set analysis, but the exppression: sum({<val={'$(=SC)'}>} "summa över")

doesent seem to work. i have tried different solutions.

Any suggestions?

18 Replies
swuehl
MVP
MVP

Could you give some examples how the returned string from GetFieldSelections() look like? For example, how many values you are selecting, how the values look like etc. You can also try

=sum({<val = Field >} "summa över")

Not applicable
Author

The variable returned is a text string, i would like sum from the set analysis to depend on what values the variable SC has, eg if i make different selections in Field the sum in the set analysis will change with the selection.

Anonymous
Not applicable
Author

len(GetCurrentSelections(''Field'))

Not applicable
Author

rgv rand, how shall i use the expression? in the set analysis? can you explain further?

thanks

Not applicable
Author

Hi rgv rand,

can you explain further? defining the variable as tour suggestion makes it numeric (as seen in text object), but how does it work in the set analysis? 

swuehl
MVP
MVP

Some examples of your selections in Field and values to match in field val would be helpful. Since you are quoting your returned variable string, multiple selected values in Field would be taken as single value to match to val. Have you tried my suggested expression?

Anonymous
Not applicable
Author

Hi

Try like this ,

keep above code in a variable and use it set analysis

In variable overview

vLen = len(getCurrentSelections('Field'))

and use it in set analysis.

sum($(vLen))

thanks

Not applicable
Author

if you compare with my set analysis expression above, will sum($(vLen)) change the sum of summa över depending of choice of Field? is sum($(vLen)) the total expression?

thanks

Anonymous
Not applicable
Author

i think you want to find the length of string which you selected  .Isn't it ?

else

elaborate your requirement

and check the variable in declaration and  expression (in question )



set vSC = 'GetFieldselections(Field)';

sum({<val={'$(=SC)'}>} "summa över")


I don't think you used the same variable in expression.