Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

passing multiple selections in one field to another field using variable

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

7 Replies
deepakk
Partner - Specialist III
Partner - Specialist III

Hi Haneesh,

I used the fieled name instaed of Variable. I hope this helps you out.

Miguel_Angel_Baeyens

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

Not applicable
Author

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

Miguel_Angel_Baeyens

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.

Miguel_Angel_Baeyens

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!

Not applicable
Author

Thanks Deepak and Miguel...it works as expected

-Haneesh

deepakk
Partner - Specialist III
Partner - Specialist III

Thanks Miguel. I was not aware of The P() function.