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

Parameter dropdown not populating

10 Answers 609 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 19 Oct 2011, 03:19 PM
This is my first shot at using the Telerik reporting tools and I'm really loving them, but I am stuck with a problem.
I have a parameter that had a DataSource bound to it. The SQL in the DataSource works fine and returns all the records it is supposed to. I have the filter set to this: =Fields.CompanyId = =Parameters.CompanyId.Value
The Parameters.CompanyIdValue is a static value with the type of string.

I have been stuck on this for 3 days now and it is becoming a major issue. Can someone give me a little guidance?

10 Answers, 1 is accepted

Sort by
0
Michael
Top achievements
Rank 1
answered on 19 Oct 2011, 08:43 PM
0
Michael
Top achievements
Rank 1
answered on 19 Oct 2011, 08:44 PM
private void FuelRecap_NeedDataSource(object sender, System.EventArgs e) {
    //Take the Telerik.Reporting.Processing.Report instance
    Telerik.Reporting.Processing.Report report = (Telerik.Reporting.Processing.Report)sender;
    // Transfer the value of the processing instance of ReportParameter
    // to the parameter value of the sqlDataSource component
    this.sdsTransport.Parameters[1].Value = report.Parameters["TransportId"].Value;
    // Set the SqlDataSource component as it's DataSource
    report.DataSource = this.sdsTransport;
}

I added this and my parameter dropdown is still empty. I need help!
0
Steve
Telerik team
answered on 24 Oct 2011, 02:14 PM
Hi Michael,

There is no need to bind the report parameters programmatically when you're using the SqlDataSource Component. Once you set it as DataSource for the Report Parameter, in the ValueMember property choose a column from the data source from which the editor to load the values and in the DisplayMember property choose a column from the data source from which the editor to draw the value labels. You can examine the provided demo reports that use this approach e.g. ProductCatalog report. Open the Visual Studio examples installed with the product and see the implementation there.

Greetings,
Steve
the Telerik team

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

0
Randa
Top achievements
Rank 1
answered on 05 Apr 2012, 12:35 AM
Using version Q2 2011
Is it possible to bind the report parameters progrmatically?
I have the same problem with 2 parameters one works fine and the other would not even if I run the stored procedure on its own it gets me the values I want.
I have a VP list of IDs and Names as a report Parameter  that is not working
and another Status list with ID and Status that is working well from another table

 

DataTable dtStatus = getAllStatus();   // stored procedure to get all Ids and Status  

DataTable dtVP = ReportVP();          // stored procedure to get all VPIds and Names  

this.ReportParameters["StatusID"].AvailableValues.DataSource = dtStatus;  

this.ReportParameters["VPID"].AvailableValues.DataSource = dtStatus; 
Here is the definition of each Report Parameter :
new Telerik.Reporting.Data.Sorting("=Fields.VPName", Telerik.Reporting.Data.SortDirection.Asc)});   

reportParameter1.AvailableValues.ValueMember = "=Fields.VPID";  
reportParameter1.Name = "VPID";  

reportParameter1.Text = "VP";  

reportParameter1.Value = "=9999";   // I have an initial value of 9999 to select all VPs  

reportParameter1.Visible = true;
// this one is working well  

reportParameter3.AvailableValues.DisplayMember = 

"=Fields.Status";  

reportParameter3.AvailableValues.ValueMember = "=Fields.StatusID"

reportParameter3.Name = "StatusID";  

reportParameter3.Text = "Status";  

reportParameter3.Type = Telerik.Reporting.ReportParameterType.Integer;  

reportParameter3.Value = "=9999";  

reportParameter3.Visible = true;

Stored Procedures used are as simple as this:
ReportVP   

SELECT 

distinct VPID , VPName  FROM tbVP

getAllStatus
SELECT StatusID, Status  FROM tbStatus

 




0
Steve
Telerik team
answered on 06 Apr 2012, 02:04 PM
Hi Randa,

The code you've posted looks correct and you can verify that by creating those report parameters and bind them directly from the Report Designer and then check the code it generated in the InitializeComponent method. If they do not work in this case either, then the problem is not with the creation but somewhere else and we would appreciate if you open a support ticket and attach a runnable sample that exhibits the problem.
Once we review it, we would be able to advise you accordingly.

Regards,
Steve
the Telerik team
NEW in Q1'12: Telerik Report Designer (Beta) for ad-hoc report creation. Download as part of Telerik Reporting Q1 2012. For questions and feedback, use the new Telerik Report Designer Forum.
0
Randa
Top achievements
Rank 1
answered on 09 Apr 2012, 06:33 PM
Thanks Steve for your reply.
When I used the report designer and binded directly it worked well.
0
Randa
Top achievements
Rank 1
answered on 11 Apr 2012, 11:13 PM
Now I have another question how can I use multivalue with both dropdownlists. Can you provide a sample of mutlivalue parameters
with cascading.
0
Steve
Telerik team
answered on 12 Apr 2012, 07:22 AM
Hi Randa,

The Product Line Sales demo report uses cascading parameters one of which is a multivalue parameter. You can also review the following articles:

All the best,
Steve
the Telerik team
NEW in Q1'12: Telerik Report Designer (Beta) for ad-hoc report creation. Download as part of Telerik Reporting Q1 2012. For questions and feedback, use the new Telerik Report Designer Forum.
0
Randa
Top achievements
Rank 1
answered on 16 Apr 2012, 08:17 PM
Thanks Steve,
I tried to create the same logic as the video and have the FormatArray user Function.

InitializeComponent();

 

//  

 

// TODO: Add any constructor code after InitializeComponent call

 

 

//

 

}

 

 

public static string FormatArray(IList<Array> array)

 

{  

StringBuilder sb = new StringBuilder();  

foreach (object o in array)

 

{

 

if (sb.Length > 0)  

{

sb.Append(

 

",");

 

}

sb.Append(o.ToString());

}

 

 

return sb.ToString();

 

}

I get this error :
The expression contains undefined function call FormatArray().

Not sure I understand in the example when you expand the document name to edit the Expression, do you specify here all the parameters needed for the report? even when I added them all, I still got this error.

= Parameters.SIDParm.Value + Parameters.DeptIDParm.Value + FormatArray(Parameters.StatusID.Value)+ Parameters.DateFrom.Value+ Parameters.DateTo.Value


I need more details on how do you capture the list of objects from the drop down list to select in a select statement or a stored procedure.

Thank you

0
Steve
Telerik team
answered on 17 Apr 2012, 12:12 PM
Hello Randa,

The error you get means that either one of these three cases has occurred:
  1. The class library has not been rebuilt and thus the function does not yet exist.
  2. Using the function with wrong number/type of parameters. The passed fields must match the function signature you've defined originally.
  3. A field specified as function argument is null. Make sure that such cases are handled in the user function.
About your last inquiry, the most accurate place where you can get/use the selected parameters is the NeedDataSource event of the Report itself (as report parameters are part of the report).

Kind regards,
Steve
the Telerik team
NEW in Q1'12: Telerik Report Designer (Beta) for ad-hoc report creation. Download as part of Telerik Reporting Q1 2012. For questions and feedback, use the new Telerik Report Designer Forum.
Tags
General Discussions
Asked by
Michael
Top achievements
Rank 1
Answers by
Michael
Top achievements
Rank 1
Steve
Telerik team
Randa
Top achievements
Rank 1
Share this question
or