/* */


Sep 16 2012

Display Multiple Values Which Are Selected In Parameters

Category: Business ObjectsRizwan Syed @ 3:17 am

As everyone know that when we have a prompt in the report  and need to display the selected values onto the report is done by the User Response function  in Web Intelligence

=Userresponse(“Selected Values:”)

Now coming in the Crystal Reports if we want to show the selected value in the prompt ,then it’s very easy by placing that object by which prompt is created  and placing it in report header or page header  of report based on the requirement. Now biggest challenge is  when the user select the multiple values from the prompt then we cannot show the selected values in the report  as by placing that object in the page header or report header.Then here are steps which  I have written the logic to display the selected values (multiple values) in Crystal Reports.

First I have Created a simple report by taking few  fields as shown below

 

Next  I have created a filter on the country object, by default when we create a parameter field in crystal reports it select only one value and for selecting multiple values  we have to  select “true”  allow multiple values from drop down.

 

After the selecting the multiple values from the parameters, now  for displaying those selected values firstly by creating a variable and place this logic

Code in the Variable:

numbervar max := count({?Country});      //Count  the selected list of values

numbervar k := 1;                                           //intializing the value for a K

stringvar output := “”;                                    //blank output value

for k := 1 to  max  do                                      //For loop and process of it continues till the max no of times(country)

(

output := output +{?Country}[k]+”,”

);

numbervar m := len(output);

left(output,m-1)                                      // removes the last comma from the output string.

 

Finally Place this variable in the report header or page header  display the country “US” and “UK”

 

Tags: ,

2 Responses to “Display Multiple Values Which Are Selected In Parameters”

  1. Rizwan Syed says:

    There may be lot of way to capture selected multiple values and as such we dont have any function to display it(As its very easy to display by UserResponse function in Web Intelligence),so that the reason I have to come with the logic as stated in my blog……

    Hope understand !!!!

  2. Ilyas says:

    Thanks Syed.

    Is this the only way to capture multiple selections in Crystal Reports?

Leave a Reply

You must be logged in to post a comment. Login now.