Crystal Reports - Passing value from one parameter

2019-08-02 21:05发布

问题:

Crystal Version: 2008

I have 2 date parameters (start date and end date). I want to create an initial Boolean parameter; that if, 'True' automatically sets the 2 date parameters to specific dates, if 'False' the user enters the start date and end date.

Basically, I want to create a parameter to drive another parameter.

Any thoughts?

回答1:

I think you should be able to use shared variables to accomplish this. You can set the values in a formula field the report header and then use the shared variables (instead of the date parameters) in your formulas.

I don't believe this will work for your main reports selection criteria though. To use it in that method you'd have to select all of the comparison data and suppress the data that you don't want to see at print time.

Update: My previous answer was directed to your specific question, but after reading your comment I think you should try to do what Craig is referring to. It sounds like you simply want to allow the user to run the report for either one date or for a range of dates. Instead of passing a boolean value that would handle this you should simply use a date parameter that has the following setting set:

allow multiple values

allow discrete values

allow range values

Then you can use the parameter in your formulas and selection criteria which will allow the use to specify the date or the date range that the user wishes to use.

I hope this helps.



回答2:

Try this approach: Crystal Reports: Named-Date-Range Parameters