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

Type own list of parameter values

11 Answers 1012 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Dwight
Top achievements
Rank 1
Dwight asked on 25 Oct 2011, 03:30 AM
Hi

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

Sort by
0
Accepted
Peter
Telerik team
answered on 26 Oct 2011, 05:35 PM
Hello Dwight,

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" };
    }
I have attached a sample report to illustrate both of the approaches.

Kind regards,
Peter
the Telerik team

Q2’11 SP1 of Telerik Reporting is available for download (see what's new). Get it today.

0
Dwight
Top achievements
Rank 1
answered on 28 Oct 2011, 12:44 AM
Thx very much, thats fantastic Peter

I will convert the code to vb and im sure the second option looks easiest for me to implement

Much appreciated
0
derek
Top achievements
Rank 1
answered on 09 Jan 2013, 10:38 PM
In case anyone else runs across this, you can also put:

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


0
Harika
Top achievements
Rank 1
answered on 25 Apr 2014, 04:48 PM
Hello Peter,

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 !
0
Harika
Top achievements
Rank 1
answered on 25 Apr 2014, 04:50 PM
Hello Peter,

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 !
0
Harika
Top achievements
Rank 1
answered on 25 Apr 2014, 04:50 PM
Hello Peter,

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 !
0
Peter
Telerik team
answered on 30 Apr 2014, 03:39 PM
Hi Harika,

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.

 
0
Harika
Top achievements
Rank 1
answered on 30 Apr 2014, 06:18 PM

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.



0
Nasko
Telerik team
answered on 05 May 2014, 10:48 AM
Hello Harika,

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.

 
0
Arlene
Top achievements
Rank 1
answered on 01 Jul 2016, 07:12 AM

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?

 

Steven
Top achievements
Rank 1
commented on 13 Jul 2022, 03:20 PM

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.

 

0
Stef
Telerik team
answered on 01 Jul 2016, 12:22 PM
Hello Arlene,

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
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
Dwight
Top achievements
Rank 1
Answers by
Peter
Telerik team
Dwight
Top achievements
Rank 1
derek
Top achievements
Rank 1
Harika
Top achievements
Rank 1
Nasko
Telerik team
Arlene
Top achievements
Rank 1
Stef
Telerik team
Share this question
or