Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
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
MVP
MVP

Re: Stringvariable in set analysis

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

Re: Stringvariable in set analysis

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.

rgvavihs
Valued Contributor

Re: Stringvariable in set analysis

len(GetCurrentSelections(''Field'))

Not applicable

Re: Stringvariable in set analysis

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

thanks

Not applicable

Re: Stringvariable in set analysis

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? 

MVP
MVP

Re: Stringvariable in set analysis

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?

rgvavihs
Valued Contributor

Re: Stringvariable in set analysis

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

Re: Stringvariable in set analysis

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

rgvavihs
Valued Contributor

Re: Stringvariable in set analysis

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.