Link to home
Start Free TrialLog in
Avatar of Sqlspider
SqlspiderFlag for United States of America

asked on

Multivalue Parameters in Header

Good Day all,

Ok I have tried everything I know to make this work but have failed.  Question I am requested to show each parameter in a header of the report that has been created meaning if in the Parameter that is set to string and multivalue and there is a range the user is allowed to pick.

Ex. 90654 to 90658 and 90660 to 90660 the end result in the header shows 90654 to 90660.

I need crystal to break apart to show 90654,90655,90656,90657,90658,90660 in the header.

I tried the following:
NumberVar Counter;
StringVar CPTs;
For Counter := 1 to UBound ({?CPT})
Do
(
CPTs := CPTs &
CStr({?CPT} [Counter],0,"") & ","
);
"CPT #s: " & Left(CPTs, Length(CPTs) -2)

Open in new window


But that fails with error message stating a number,currency amount,boolean,date,time,date-time,or string is required here.

If "" In {?CPT} Then 
    "All CPTs"
Else
     Join({?CPT}, ", ")

Open in new window

a string array is required here.

If I do these same statements with state for instance, it shows in the header with the desired results.

Where am I going wrong with the numeric value. I have used Cstr and ToText to change to a string but still nothing is working.

Any help Thanks much!
Avatar of Mike McCracken
Mike McCracken

CPT is apparently a Numeric parameter. JOIN only works on string arrays so your second method won't work.

What is highlighted in your first formula.

Can you show the parameter screen for the CPT parameter?

Are you trying to allow multiple values and multiple ranges?

mlmcc
Avatar of Sqlspider

ASKER

mlmcc yes you're correct the parameter is Numeric.

Send-to-Experts-Exchange.ppt

Yes I need it to allow multiple values and multiple ranges  but when the report displays I need this:

Ex. 90654 to 90658 and 90660  the end result in the header shows 90654 to 90660.

I need crystal to break apart to show 90654,90655,90656,90657,90658,90660 in the header regardless of range or multivalues added.

Thanks
mlmcc
I don't know how to handle multiple ranges without some trial and error.  I will see what I can get to work.

What version of Crystal?
I don't recognize those parameter screens.

mlmcc
I am almost ashamed to say but it is Crystal 8.5. This group does not want to get off this version due to the CIO as much as I have tried to get him to change.  

mlmcc any help would be great I have tried all types of things and just can not get this to work.
How they run the reports ?
The reports are ran by an executable that I push out on the server for the users to run. So they enter there parameters and the reports pull back the information needed showing in either the header or in the report footer the parameters that they selected.

SqlSpider
ASKER CERTIFIED SOLUTION
Avatar of James0628
James0628

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
James I was feeling good with this and had hoped that this was going to work but,

I get the following message after entering in the parameters.

The formula section appears for where I placed your coding with the following: A number range is required here.  

Once you click ok the blinking cursor blinks next to the following line.

if 0 in |{?CPT} then

I was for certain this would have worked. I am playing around with the code now to see what else I can try with what you have written. I feel like its close but I am missing something so obvious.  

SqlSpider
James,

Perfect on the parameters showing thanks, but now the report will not filter on the parameters that I have chosen to have crystal pull back the expected results.  Here is what is in the Select Expert section formula:

({SQL Table}={?CPT} or {?CPT}='')  This is giving me all CPTs in that SQL Table and not just the ones that are now showing in the Parameters
FWIW, the 0 IN {?CPT} test worked fine for me, but I had CPT as a number parameter.  Based on your last post, it looks like CPT is not a number parameter in your report.  That would probably explain the error that you got.

 As for your selection formula, obviously anything that you do in a formula that just displays the parameter values is not going to have any effect on the record selection, so the question is, what did you change while working on the display formula?  I assume that you changed something about the parameter.  Maybe changed it from number to string?

 You're probably getting the "all" option (empty string) when you don't really want it.

 Do you have an empty string included in the parameter values by default or something?  {?CPT} = "" will be true if there is an empty string anywhere in the parameter values.

 James