Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a variable
V_SEL_SEG =if(getfieldselections(Segment)>0,concat(Chr(39) & Replace(getfieldselections(Segment), ',', Chr(39) & ',' & Chr(39)) & Chr(39)))
and - in short - a set expression using this variable:
Sum({<Segment={"$(=$(V_SEL_SEG))"}>}Value).
The above set expression works when a single value is selected in the Segment filter.
But when I select multiple values in the filter the set expression returns only the sum of values of the Segment selected first although the information in the formula editor is showing that three values were selected.
Can anyone please guide me how to fix this expression ?
Appreciate your help !
Thanks,
Martina
Your variable-expression isn't quite correct because it adds an extra space in front of each value (it's hard to notice on your screenshots but if you sized them big enough it will be visible).
Beside this what is the aim of adding this condition within the expression? Wouldn't it be easier and better to skip this part as it is (nearly) the same like a normal selection? If you really want to keep this logic you may consider an easier approach with p() like:
Sum({<Segment = p(Segment)>} Value)
- Marcus
can you try this?
your varibale:
V_SEL_SEG ='if(getfieldselections(Segment)>0,concat(Chr(39) & Replace(getfieldselections(Segment), ',', Chr(39) & ',' & Chr(39)) & Chr(39)))'
exp:
Sum({$<Segment={'$(V_SEL_SEG)'}>}Value)
Your variable-expression isn't quite correct because it adds an extra space in front of each value (it's hard to notice on your screenshots but if you sized them big enough it will be visible).
Beside this what is the aim of adding this condition within the expression? Wouldn't it be easier and better to skip this part as it is (nearly) the same like a normal selection? If you really want to keep this logic you may consider an easier approach with p() like:
Sum({<Segment = p(Segment)>} Value)
- Marcus
You are right: I changed the value to be replaced from ',' to ', ' (Comma - Space) and now it's working.
The p(Segment) solution also works, but my intention is to move the diagram to an alternate state - except for filter settings that are done for the Segment field in the original state. That's why it need the variable.
Thank you so much, you saved my day 😀
Martina