How to set a parameter value in and embedded rdlx report at runtime?

Posted by: josemiguel.alcalde on 12 October 2020, 7:07 pm EST

  • Posted 12 October 2020, 7:07 pm EST

    Hello

    I have made a parametrized report with activereports and I embedded in a dll.

    Everything it's working fine with default values, but I doesn't no know how to set the parameters value at runtime.

    I have read the documentation, and I find the setParametersValues() function, para it ask me an Grapecity.Viewer.Common.iparameter interface, but I don't know the class that implements this interface.

    Could you help me please.

    This is the method I'm using to load de report.

    Thanks



    public void CargarReport(string reporte,string ensamblado)
    {
    Assembly assembly=string.IsNullOrEmpty(ensamblado)? Assembly.GetExecutingAssembly(): Assembly.LoadFrom(ensamblado);
    stream = assembly.GetManifestResourceStream(reporte);
    viewer1.LoadDocument(stream, GrapeCity.Viewer.Common.DocumentFormat.Rdlx);
    viewer1.SetParametersValues();
    }
  • Marked as Answer

    Replied 13 October 2020, 3:13 pm EST

    Hello,

    Please use the following line of code:
    viewer1.LoadDocument(r1.Document);
    GrapeCity.ActiveReports.Viewer.Win.ReportParameter param = new GrapeCity.ActiveReports.Viewer.Win.ReportParameter("CategoryName", "Condiments");
    IList<GrapeCity.Viewer.Common.IParameter> pc = new List<GrapeCity.Viewer.Common.IParameter>();
    pc.Insert(0, param);
    viewer1.SetParametersValues(pc);
    Hope it helps.;

    Thanks,
    Mohit
  • Replied 12 November 2020, 2:38 am EST

    Thank you very much, it works great
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels