How to add a report variable for a report in local mode?


  • Hello, this article describes how to add a report variable...but it seems the local mode does not support that? Whn I open the report menu, there is no "variables" menu item. How is that done in local mode?

    Furthermore, on another article, it says:

    If you do not want this on-demand behavior in particular cases (e.g. time-dependent calculations, custom code, or expensive calculations requiring caching), you should use so-called Report Variables or Group Variables, and then reference the variable value in the report (e.g. =Variables!V1.Value).  Variables are covered in more detail in a previous posting.  If it is just about consistent time stamps, you should instead use =Globals!ExecutionTime, regardless of the version of Reporting Services (more info on global built-in collections is available on MSDN).

    How can I do that in local reports (RDLC instead of RDL) ... it must be possible!

    Thanks :-)
    Friday, July 2, 2010 8:35 AM


  • Hi aqid,

    Based on your information , I get that you want to add variables in RDLC file like in Reporting Service, as per my experience, we probably could not achieve this in local module, variable is the featrue of Reporting Service. But in code-behind , we could add some parameters to the report just like this:

           ReportParameter rp0 = new ReportParameter("Report_Parameter_UserName", User.Identity.Name);
           ReportParameter rp1 = new ReportParameter("Title", Chart1.Title);
           ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp0, rp1 });

    Then in report body, we could utilize these parameters, such as type in the expression in the textbox =Parameters!Title.value

    Hope this helps.


    Challen Fu

    Monday, July 5, 2010 11:41 AM