This is a migrated thread and some comments may be shown as answers.

Several optional parameters, but at least one required

1 Answer 276 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ken
Top achievements
Rank 1
Ken asked on 29 Jan 2016, 07:29 AM

Hello,

 I have a report with optional parameters, but at least one needs to be specified to run the query (stored proc).

FromDate (Required)
ToDate (Required)
Invoice (Optional)
PurchaseOrder (Optional)
Customer (Optional)

 In this case, either Invoice, PurchaseOrder or Customer must be specified. I don't want the query to run if none of these are specified so right now I throw an exception from the stored proc if all are null, but this results in a non-user-friendly error message.

Thank you

1 Answer, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 02 Feb 2016, 11:41 AM
Hello Anders,

Using the built-in properties of the report parameters (during report you are able to configure one or more parameters to be required by setting their AllowNull and AllowBlank properties to False.
However, these properties do not offer an option to make a group of parameters required e.g., at one parameter of the whole group to have a value. Thus, in order to achieve the described effect, you will need to hide the default report parameters area (set Visible = False for all report parameters) and implement your own custom parameters UI and validation in your application.
After the values from the custom UI have been validated, you can pass them via the Report Source to the report.

Regards,
Nasko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Ken
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Share this question
or