Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameter for distinct and range values

Status
Not open for further replies.

crystalreporting

Instructor
Feb 13, 2003
649
NZ
While Crystal allows for parameters with combinations of distinct and range values, the report viewer I am using does not support that type of input. I would like the end user to be able to enter a single string parameter with distinct and range values i.e.

'A', 'B', 'D' to 'F'

So that the report results show A, B, D, E, F.

I can manually set the selection criteria to work this way e.g. {TABLE.Field} in ['A', 'B', 'D' to 'F'] returns the correct results. However if I change this to use a parameter e.g. {TABLE.Field} in '[' & {?Parameter} & ']' and key the parameters values in the range portion does not work.

Any ideas?

Peter Shirley
Macola Consultant, PA and surrounding states.
 
Ditch the brackets. My formula was:

{Command.Codes} in {?Codes}
 
Tried it without the brackets - same result. When I manually set the selection criteria using the 'to' option it works OK. When I pass this in via a parameter, it does not work e.g.

{TABLE.Field} in ['A', 'B', 'D' to 'F'] returns A, B, C, D, E and F.

{TABLE.Field} in {?Parameter} where parameter value = 'A', 'B' , 'D' to 'F' returns A, B and D.



Peter Shirley
Macola Consultant, PA and surrounding states.
 
Whoops - that should have read;

{TABLE.Field} in ['A', 'B', 'D' to 'F'] returns A, B, D, E and F.

{TABLE.Field} in {?Parameter} where parameter value = 'A', 'B' , 'D' to 'F' returns A, B and D.



Peter Shirley
Macola Consultant, PA and surrounding states.
 
Whoops - that should have read;

{TABLE.Field} in ['A', 'B', 'D' to 'F'] returns A, B, D, E and F.

{TABLE.Field} in {?Parameter} where parameter value = 'A', 'B', 'D' to 'F' returns A, B and D.



Peter Shirley
Macola Consultant, PA and surrounding states.
 

Sorry I misread your post. I set up the parameter prompt to allow for ranges and discrete values and that works for me.

Allow Multiple Values - True
Allow Discrete Values - True
Allow Range Values - True

Makes for an ugly parameter prompt but it works.
 
Yep - setting up the parameter within Crystal works that way OK. However, as I said in my original post, the report viewer I'm using with my reports does not support multiple value parameters i.e. the only way I can capture ranges and discrete values is in a single string. I want the user to be able to enter 'A', 'B' , 'D' to 'F' in a single input field and have the report return the correct results.

Peter Shirley
Macola Consultant, PA and surrounding states.
 
I think the issue is that when the parameter is presented as a single-value string, CR can't interpret the "to". It is simply looking for the presence of certain values in the literal string--so I think you would have to require users to spell out all values rather than attempting to abbreviate with ranges.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top