Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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?
Hi,
If the dimension values has any spaces then this expression won't work.
Try like this
sum({<val=P(Field)>} "summa över")
OR
vSC = chr(39) & GetFieldselections(Field, chr(39), ',', chr(39)) & chr(39)
and use below expression
sum({<val={'$(=vSC)'}>} "summa över")
Regards,
Jagan.
Hi Jagan,
Still doesent work, i modified to = chr(39) & GetFieldSelection(Field) & chr(39), this gives quotes round the variable but the sum function still not functioning.
/Anders
Hej!
I hope I understand right, maybe this work:
sum({<Val={'$(=($(vSC)))'}, Field=>} [Summa över])
I attach an example.
Hej då!
/Giuseppe
Hi,
Try this
sum({<val={$(=vSC)}>} [summa över])
Regards,
Jagan.
Anders,
'still doesn't work' is not a very helpful answer to us.
Again, why don't you come up with some sample data of the two fields in question.
Using GetFieldsSelection() might finally work, but has some limitations, e.g when selecting large amounts oft values. To get potentially needed quoting correct is also not trivial.
Since you still have issues getting the expected results, why don't you come up with some sample values of these two fields involved?
And I still got no answer why my very first suggested expression, which seems IMHO most simple and robust, is not working for you:
=sum({<val = Field >} [summa över])
where Field is the field you used in GetFieldSelections() before. This should apply the selections in field Field to field val, where values are matching.
Hi Anders,
I think (like other person) it is better if you post an example (also a qvw test file) so we can understand what you need exactly.
My example is good for you or not?
/Giuseppe
Hi In your variable trigger,
use the following
=chr(39)& Replace(GetFieldSelections(val),', ',chr(39)&','&chr(39))&chr(39)
and the set expression should be simple
sum({<val={$(=vSC)}>} [summa över])
This should work with multi selects and values with spaces in them
Please check the file
Hi Anders,
Have you managed to get this working?
Sasi