Crystal Reports Range Parameter

Hi all,

I have a report (written in Crystal 9) whereby the user enters 2 numerical parameter range values. For example the user enters Value1 = 1 and Value2 = 5.

I then want my report to display 5 details, one for each value between and including the range values. So this would show 5 detail values 1,2,3,4 and 5.

How do I do this?

Thanks in advance
Who is Participating?
Another way to do this if you can add a table to the database is to create a table with a column for all potential trace numbers.  You can then include it in the report and select on it.  There is no need to join it to the current data since you really want a cross join.

Does your data actually include records for every value in the range?

 If it does, it should be simple.
 If it does not, you can try to get the report to show something for any missing data.  Whether or not that will work may depend on how complex your report and data are.

 As far as the range goes ...

 Are you actually using a range parameter (a single parameter that allows a range of values), or two separate parameters (one with the minimum value and one with the maximum)?

 If it's a range parameter, you can go to the record selection formula and enter a test like:
{your field} = {?range parameter}

 CR will understand that the parameter is a range and include every value in the range.

 If you have two separate parameters, the test would be something like:
{your field} >= {?start parameter} and {your field} <= {?end parameter}

 I haven't used CR 9, but in CR 10 you can get to the record selection formula by going to Report > Selection Formulas > Record.

FMabeyAuthor Commented:
Hi James,

Thanks for your reply.
I am using a single parameter which I have set to type number and has range value(s) checked. The user is then presented with two boxes 'start of range' and 'end of range'

Unfortunately, none of the values defined in the parameters exist in my data! Essentially, my data will return only one row, a part ID. We print out a set of pre-defined trace numbers (my parameter values). So if we want 5 of these parts, the user will enter the next set of available trace numbers, so that may be 6 to 10 for example.

I then want the detail multiplied 5 times to show the part ID on each detail, along with the next value in the range.


PartID = P16
Range = 6 to 10


PartID: P16
TraceID: 6

PartID: P16
TraceID: 7

PartID: P16
TraceID: 8

PartID: P16
TraceID: 9

PartID: P16
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.

Ah.  So you're basically trying to duplicate the data a certain number of times, based on the range.  It sounds similar to the situation where someone is printing labels and wants to print a varying number of copies of each label, based on a field (like a quantity).

 One way to do that kind of thing is to have a table that just contains a list of numbers, and Join your main table to that, based on some field, so the data is repeated X number of times.  But that may not fit your situation that well, since I don't know if you have a field that could be used to Join the two tables.

  How big could the range be?  If it's not too big, you could create duplicate copies of your detail section, and then suppress the ones that you don't need to see.  For example, if the range will never be larger than 10, create 10 detail sections with your PartID field, and then use section suppression formulas like the following:

 For the second detail section:
{?end of range} - {?start of range} < 1

 For the third detail section:
{?end of range} - {?start of range} < 2

 and so on.

 For the TraceID, you could use a different formula in each section that adds X to {?start of range}.  Add 0 in the formula in the first detail section, 1 in the second, and so on.

 But if the range could be too large, then using multiple copies of the detail section may not be practical/possible.

FMabeyAuthor Commented:
Thanks for your help guys.

James, you pushed me in the right direction and mlmcc, thanks for the suggestion of an unlinked table... Works a treat.

Thanks, mlmcc.  I thought about a cross-join, but I wasn't sure it would work, and thought it might be really inefficient even if it did.  I've never needed one, so I really didn't know.

 And you're welcome, FMabey.

It could be inefficient but it is probably since the report is probably only getting 1 record it won't be noticed.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.