on ‎2010 Oct 22 2:31 PM
I have trouble getting a parameter work in Crystal Reports. I have defined a Parameter variable in the report. The parameter should restrict the data if a value is entered or it has to bring back all the data if the Value is NULL. In the SELECT EXPERT I have a condition that says IF ISNULL (Parameter_FIELD) then a Default Value.
When I run the report I get an error saying that the Parameter has NULL Value. Even If I default it with some Value the report is not working the way we want to. Is there a way I can do what I am trying to achieve. Please advice.
Request clarification before answering.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm not sure how this is even an issue... The user shouldn't be able to leave a parameter empty. CR won't close the parameter screen until all parameters have a value.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here is what I found. Any numeric cannot be blank in Crystal Reports. We have to create a Non Numeric Parameter.
In the following example ARG_SRC_ID is a non numeric parameter. By default it will prompt the user with % which means that if the user enter % sign it will fetch all the data.
Since we are defining the ARG variable as Numeric I have to change the non numeric to Numeric format using TONUMBER function. Hope this helps.
IF {?ARG_SRC_ID} = "%" then
{SRC_AUD.SRC_ID} = {SRC_AUD.SRC_ID} else {SRC_AUD.SRC_ID} = tonumber ({?ARG_SRC_ID})
Crystal reports should come up with better way to handle this. This should not be very tricky.
You could pick a value to represent a null. 'Null' would work if it is a text parameter.
Now create a formula {@null}
If parameter ="null" then 1 else 0In your select expert use
({@null}=1 or field=parameter)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 8 | |
| 7 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.