• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 310
  • Last Modified:

Formula to display what multiple parameters were selected after a report is run

Hello Experts,

I have a multiple value parameter that allows users to select any score ranging from 0 to 5 so that they can see mixed results.  For example, a user can select to see records with a score of 3 and a score of 4.  

What I want to do is create a title in the page header that shows the user the values that they have selected for the report.  When I drag the parameter into the page header it only displays the first value selected not all values.  Is there a way to show all values selected after my report is run?
0
cyardley
Asked:
cyardley
  • 4
  • 2
  • 2
1 Solution
 
Kurt ReinhardtCommented:
You can use the Join function within a formula field.  For example Join({?Parameter},", ").  In this case, I've created a delimiter of a comma and space following each value returned.
0
 
cyardleyAuthor Commented:
Thanks for the reply.

I think I'm misunderstanding exactly what to do.  I put that example above into the following formula:
Join({pScore},",")

When I do that I receive the error, "A String Array is required here"

I apologize.  I am at a beginner level to Crystal so I may be misunderstanding you.

Thanks!
0
 
Kurt ReinhardtCommented:
In your case, {pScore} isn't a parameter field.  Parameter fields have ? in front of them.  Since you want to display the actual parameters the users selected, you need to include that in your formula.  If your parameter doesn't allow multiple values, then you'll get an error message.  Assuming the parameter does and that you've used the correct field and syntax correctly, all should go well.
0
Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

 
cyardleyAuthor Commented:
I apologize.  In the formula that I wrote above I missed putting the ? in front of the parameter.  This is a copy of the formula directly from the report:
Join({?pScore},",")
My parameter is set to allow multiple values and my report is returning the records.  However, I must be using the syntax that you've sent incorrectly because I still receive the "String Array is required here" error.
0
 
mlmccCommented:
I assume the parameter is using numeric values.

You probably need to do it this way

Loacl StringVar ParamList := '';
Local NumberVar i;

For i := 1 to UBoud({?pScore}) do
(
    If ParamList = '' then
        ParamList := CStr({?pScore[i]},0)
    else
        ParamList := ParamList & ', ' & CStr({?pScore[i]},0)
);
ParamList

mlmcc
0
 
cyardleyAuthor Commented:
mlmcc,

Thank you.  That formula returns the values that I am looking for.  Each value is assigned a classification as well.  For Example if the score is 0, the Classification is "Failed".  Is there a way that after the formula that you have above runs I can dispaly the classification on the report as well?

My score value and classifications are:
0 = Failed
1 = Insufficient
2 = Possible
3 = Minor
4 = Moderate
5 = Major

Your formula did answer my original question.  So if necessary I can close this thread and award the points then open a new question.

Thanks!
0
 
cyardleyAuthor Commented:
I've decided to close this thread since mlmcc's response does answer my original question.  I will open a new thread regarding the new question.

thanks!
0
 
mlmccCommented:
Sure.

If they won't change so you have to maintain this code then something like this.  If they will change then I would recommend adding a table to the database and linking it or using and SQL expressiion.

If {Score} = 0 then
    'Failed'
else if {Score} = 1 then
   'Insufficient'
...

mlmcc
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now