Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have two fields [Product] and [Product selection]. The user will select multiple [Product Selection] values which should be used to filter [Product] value in a calculation. I have assigned the current selections of [Product Selection] into a variable and use this variable in set analysis to filter [Product].
The problem here is when there are no space between the [Product Selection] values the expression is working fine but, when we have a space with in a product value, I am not getting the result.
In the attached document I have two fields Field 1 and Field 2. The variable 'var' get the current selected values of field 1 and passes it to field 2 in the set analysis expression. When I select 'A' or 'B' or both, correct value is obtained. When I select 'C C' or 'D D', the value is not calculated.
How can I resolve this problem.
Thanks,
Haneesh
Hi Haneesh,
I used the fieled name instaed of Variable. I hope this helps you out.
Hello Haneesh,
Since they are literals, they need to be quoted, so changing the variable to
=getFieldSelections(Field1, chr(39) & ',' & chr(39))
and the expression to
sum({<Field2 = {'$(var)'}>} Value)
Should work.
Hope it helps
Thanks Deepak.
The selection works perfectly.
The other issue is, by default when no value is selected, I want all the report to show data for all values. How can we achieve this?
-Haneesh
Hello Deepak,
I'd use instead P() function
sum({$<Field2 = P(Field1)>} Value)
since when several results are possible, direct assignment takes lots of time, even it crashes. Reference manual says similar.
Regards.
Hello Haneesh,
The expression with P() function as above will pass all possible values for the field used. So if there is no selection, then all values are possible, and they are shown this way.
Hope it helps!
Thanks Deepak and Miguel...it works as expected
-Haneesh
Thanks Miguel. I was not aware of The P() function.