Moving from ssrs to Telerik reporting I am finding it mostly easy to understand and the transition reasonably smooth but one thing I cant work out after much searching and experimenting is how to supply a list of values to use as a parameter selection for the end user without having to use a datasource
Many of the parameters I will be using in my reports simply require the values
Yes
No
or
Not started
In progress
Complete
In ssrs is was easy to use the report parameters dialog to type in the text / value pairs but i cant find that functionality in the parameter collection dialog in Telerik reporting
I would appreciate if anyone can assist as I would prefer not to have to make a table for each parameter value
Regards
Dwight
11 Answers, 1 is accepted
You have two options:
- add an user function as the following one, for AvailableValues.DataSource set up ObjectDataSouce, select the user function as data member and define the datasource parameter values:
public
static
object
[] ConvertCommaSeparateStringToArray(
string
value)
{
return
value.Split(
','
);
}
- set up the report parameters available values directly in the report's constructor as shown in the following code snippet:
public
Report1()
{
//
// Required for telerik Reporting designer support
//
InitializeComponent();
this
.ReportParameters[
"Parameter2"
].AvailableValues.DataSource =
new
object
[] {
"Not started"
,
"In progress"
,
"Completed"
};
}
Peter
the Telerik team
Q2’11 SP1 of Telerik Reporting is available for download (see what's new). Get it today.
I will convert the code to vb and im sure the second option looks easiest for me to implement
Much appreciated
this
.ReportParameters[
"transactionTypeCode"
].AvailableValues.DataSource =
new
object
[] {
new
{ Text =
"All"
, Value =
"_"
},
new
{ Text =
"Credit"
, Value =
"C"
},
new
{ Text =
"Debit"
, Value =
"D"
} };
Then assign DisplayMember to Text and ValueMember to Value in the ReportParameter Collection Editor.
In this case I also get creative with the query so I can display credits, debits or both. The WHERE clause has:
AND
CASE
@transactionTypeCode
WHEN
'_'
THEN
'_'
ELSE
x.TransactionTypeCode
END
= @transactionTypeCode
I tried to implement the solution you proposed in mine and it displayed empty values in the drop down .
public StateReports()
{
//
// Required for telerik Reporting designer support
//
InitializeComponent();
this.ReportParameters["HelloString"].AvailableValues.DataSource = new object[] { "All State Cases", "Non-UNISYS Only", "UNISYS Only" };
}
It displayed no value in the drop down and gave me an undescriptive error "Missing or invalid parameter value. Please input valid data for all parameters".
Not Sure where I went wrong. "HelloString" is the name of my parameter and I have bound the DisplayMember and ValueMember properties to = Parameters.HelloString.Value
I am not sure where I am going wrong and would appreciate your suggestions:
Thanks for your time in advance !
I tried to implement the solution you proposed in mine and it displayed empty values in the drop down .
public StateReports()
{
//
// Required for telerik Reporting designer support
//
InitializeComponent();
this.ReportParameters["HelloString"].AvailableValues.DataSource = new object[] { "All State Cases", "Non-UNISYS Only", "UNISYS Only" };
}
It displayed no value in the drop down and gave me an undescriptive error "Missing or invalid parameter value. Please input valid data for all parameters".
Not Sure where I went wrong. "HelloString" is the name of my parameter and I have bound the DisplayMember and ValueMember properties to = Parameters.HelloString.Value
I am not sure where I am going wrong and would appreciate your suggestions:
Thanks for your time in advance !
I tried to implement the solution you proposed in mine and it displayed empty values in the drop down .
public StateReports()
{
//
// Required for telerik Reporting designer support
//
InitializeComponent();
this.ReportParameters["HelloString"].AvailableValues.DataSource = new object[] { "All State Cases", "Non-UNISYS Only", "UNISYS Only" };
}
It displayed no value in the drop down and gave me an undescriptive error "Missing or invalid parameter value. Please input valid data for all parameters".
Not Sure where I went wrong. "HelloString" is the name of my parameter and I have bound the DisplayMember and ValueMember properties to = Parameters.HelloString.Value
I am not sure where I am going wrong and would appreciate your suggestions:
Thanks for your time in advance !
Using the code bellow we have successfully added available values for the HelloString parameter. Give it a try and if you experience any further difficulties please open a support thread and send us the problematic report definition.
this
.ReportParameters[
"HelloString"
].AvailableValues.DataSource =
new
object
[] {
"All State Cases"
,
"Non-UNISYS Only"
,
"UNISYS Only"
};
this
.ReportParameters[
"HelloString"
].AvailableValues.ValueMember =
"=Fields.Item"
;
this
.ReportParameters[
"HelloString"
].Visible =
true
;
this
.ReportParameters[
"HelloString"
].Type = ReportParameterType.String;
Regards,
Peter
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.
Thanks Peter.I added the following code in my reports constructor and have set the displaymember property to Text and valueMember property to Value and it worked fine for me.
public Reports()
{
this.ReportParameters["SelectOne"].AvailableValues.DataSource = new object[] { new { Text = "All State Cases", Value = "_" }, new { Text = "Non-UNISYS Only", Value = "NU" }, new { Text = "UNISYS Only", Value = "UN" } };
}
I am now running into another issue. I opened up a new thread for it. This is what the issue is. I am unable to see events tab in the properties window for the detail section of my report. I am using Telerik Control Q1 2014 and installed them with admin rights. I am using VS 2010 , windows 7 and 32-bit OS. Is there anything wrong with my installation. I appreciate your help in advance.
Thank you for reporting this issue. We have requested some additional information on the issue in your other thread. Let us continue the discussion there, as the problem is not related to the topic discussed in this forum thread.
Regards,
Nasko
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.
Hello ,
How do i achive the same with trdx file .
i am working with telerik standalone designer and i have requirement to add a paramter that is dropdownlist in my report with predefined values.
i don"t want to use sqldatasource.
please advice me
i want to add 4-5 items to dropdown paramter that is fixed not coming from anydatabase
is there any solution?
Why not just create a SQL data source in designer? For example create a new sql data sources and add sql like follows:
select 0 as DayNum,'All Days' as WeekDay union
select 1 as DayNum,'Sunday' as WeekDay union
select 2 as DayNum,'Monday' as WeekDay union
select 3 as DayNum,'Tuesday' as WeekDay union
select 4 as DayNum,'Wednesday' as WeekDay union
select 5 as DayNum,'Thursday' as WeekDay union
select 6 as DayNum,'Friday' as WeekDay union
select 7 as DayNum,'Saturday' as WeekDay
This is an example of how you can get a drop down list of days of the week for a parameter.
Below is a quote from my response in your support ticket# 1047577:
"Please test if using the CsvDataSource component with 'CSV as Text' suites your requirements. Details how to configure the component are available in CsvDataSource Wizard."
I hope this helps.
Regards,
Stef
Telerik