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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Limit Range Parameter

Status
Not open for further replies.

ddnh

Programmer
Nov 25, 2002
94
US
Is there a way to limit the range selected with a range parameter? I don't need to limit the range to certain values or limit the min/max lengths. I need to let the user select any year. The second part of the range can only be the same year, the next year, or two following. Any ideas how to do this?

EX: If the user selects 2002 as the first year, the options for the end of the range should only be 2002, 2003, or 2004.

 
Crystal itself can't do this, some third party viewers can.

You might take a different tact, create the start date parameter, and then ask how many years they want to view for and have the choices prefilled, and not editable, then use the dateadd() function to create the end date.

-k
 
I make a check in my selection formula.. something like if datediff(&quot;w&quot;,d1,d2)>1 then x else if datediff(&quot;w&quot;,d1,d2) <= 1 then y. Then i change the &quot;end&quot; date to the max range if they have exceeded it and place a notice in the report header that I have done so. You need to work with the selection formula a bit to make certain that it sends it to the server correctly.

Lisa
 
My requirements changed so that I only need 2 years. This made the solution pretty easy for me since there is room on the report to have both columns of data. I took the first half of synapsevampires solution. I already had a parameter for year. I added another one for NumYears and set the defaults to 1 and 2 (and marked that you can't edit the values). Then I suppressed the year 2 labels and fields when NumYears = 1. Worked perfectly!

By the way, my stored procedure is getting two years worth of data. Year and Year + 1. So I didn't need to do anything in the selection criteria or use the dateadd() function.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top