Several optional parameters, but at least one required

2 posts, 0 answers
  1. Anders
    Anders avatar
    3 posts
    Member since:
    Apr 2015

    Posted 29 Jan Link to this post


     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

  2. Nasko
    Nasko avatar
    908 posts

    Posted 02 Feb Link to this post

    Hello Anders,

    Using the built-in properties of the report parameters (during report design-time) 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 least 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.

    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
  3. DevCraft R3 2016 release webinar banner
Back to Top