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

How to add a value to a report parameter.

3 Answers 376 Views
Report Designer (standalone)
This is a migrated thread and some comments may be shown as answers.
Randy
Top achievements
Rank 1
Randy asked on 11 Jun 2014, 07:22 PM
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.

3 Answers, 1 is accepted

Sort by
0
Accepted
Stef
Telerik team
answered on 16 Jun 2014, 07:32 AM
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.

 
0
Randy
Top achievements
Rank 1
answered on 16 Jun 2014, 03:38 PM
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)"?
0
Randy
Top achievements
Rank 1
answered on 16 Jun 2014, 03:46 PM
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.
Tags
Report Designer (standalone)
Asked by
Randy
Top achievements
Rank 1
Answers by
Stef
Telerik team
Randy
Top achievements
Rank 1
Share this question
or