Parameter dropdown not populating

11 posts, 0 answers
  1. Michael Barbu
    Michael Barbu avatar
    12 posts
    Member since:
    Feb 2010

    Posted 19 Oct 2011 Link to this post

    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?
  2. Michael Barbu
    Michael Barbu avatar
    12 posts
    Member since:
    Feb 2010

    Posted 19 Oct 2011 Link to this post

  3. DevCraft banner
  4. Michael Barbu
    Michael Barbu avatar
    12 posts
    Member since:
    Feb 2010

    Posted 19 Oct 2011 Link to this post

    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!
  5. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 24 Oct 2011 Link to this post

    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.

  6. Randa
    Randa avatar
    14 posts
    Member since:
    Jul 2011

    Posted 04 Apr 2012 Link to this post

    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

     




  7. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 06 Apr 2012 Link to this post

    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.
  8. Randa
    Randa avatar
    14 posts
    Member since:
    Jul 2011

    Posted 09 Apr 2012 Link to this post

    Thanks Steve for your reply.
    When I used the report designer and binded directly it worked well.
  9. Randa
    Randa avatar
    14 posts
    Member since:
    Jul 2011

    Posted 11 Apr 2012 Link to this post

    Now I have another question how can I use multivalue with both dropdownlists. Can you provide a sample of mutlivalue parameters
    with cascading.
  10. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 12 Apr 2012 Link to this post

    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.
  11. Randa
    Randa avatar
    14 posts
    Member since:
    Jul 2011

    Posted 16 Apr 2012 Link to this post

    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

  12. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 17 Apr 2012 Link to this post

    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.
Back to Top
DevCraft banner