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
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!
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.
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
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
When I used the report designer and binded directly it worked well.
with cascading.
The Product Line Sales demo report uses cascading parameters one of which is a multivalue parameter. You can also review the following articles:
- Product Line Sales how to video
- Using Multivalue Parameters
- How-To: Cascading Parameters with applied filtering on Report level
- How-To: Cascading Parameters with applied filtering on data source level
All the best,
Steve
the Telerik team
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
The error you get means that either one of these three cases has occurred:
- The class library has not been rebuilt and thus the function does not yet exist.
- Using the function with wrong number/type of parameters. The passed fields must match the function signature you've defined originally.
- A field specified as function argument is null. Make sure that such cases are handled in the user function.
Kind regards,
Steve
the Telerik team