How to add a value to a report parameter.

4 posts, 1 answers
  1. Randy
    Randy avatar
    12 posts
    Member since:
    Apr 2014

    Posted 11 Jun 2014 Link to this post

    So I've got what I feel is a decent understanding of the 'Available Values' part of the report parameter property. I have a working query that is pulling multiple values from a table and displaying them properly. My question is (without altering the database) how can I add another value to the options? Basically if the query is pulling back 'foo' and 'bar', I want to also give the user the option for 'All'. Right now the only things that are being returned from the DB is 'foo' and 'bar', I want just tack on the option for 'All' without changing the database.
  2. Answer
    Stef
    Admin
    Stef avatar
    3036 posts

    Posted 16 Jun 2014 Link to this post

    Hello Randy,

    With report parameters you can:
    • Set the parameter's MultiValue property to true, which will add automatically 'select all' option;
    • Set the AllowNull property to true and interpret the Null value in the data retrieval method;
    • In the data retrieval method add a record that will be interpreted as 'select all'. For example in a SQL query you can use UNION to add the value.

    I hope this information helps you.

    Regards,
    Stef
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. DevCraft banner
  4. Randy
    Randy avatar
    12 posts
    Member since:
    Apr 2014

    Posted 16 Jun 2014 in reply to Stef Link to this post

    That is helpful, I was using the null option previously, but it seems as though I wanted the multi-value one instead. However it leads to another question that I'm not sure of the answer to at the moment. Since your multi-value basically just adds a comma to the various options that are selected, how would I go about adding a check my sql statement that uses it correctly?

    I was previously using isNull() to check if it was null in which case I'd use a wildcard instead, is there a simple function that I don't know about that I could use that would say something to the effect of if "parameter = (comma seperated list)"?
  5. Randy
    Randy avatar
    12 posts
    Member since:
    Apr 2014

    Posted 16 Jun 2014 in reply to Randy Link to this post

    Nevermind, I just had to re-write it with an IN statment, it wasn't working at first because I didn't have the () around it. For other's benifit, the statement I ended up using was "o.OrderType in (@JobType)" where jobtype cannot be null, but can be multi-valued.
Back to Top