Page 1 of 1

Dashboard variables

Posted: Mon Feb 04, 2019 4:16 pm
by r.bianco
On Reports.Web I use some variables to print or filter data on the report.
I'm using 2019.1.1

On Page_Load event I have the following:

Code: Select all

StiReport myReport = new StiReport();
myReport.Load(strReportAbsolutePath);
myReport.Dictionary.Variables["MyVar"].Value = Session["var"].ToString();
The web demo code shows you just need to istantiate the StiReport and load the dashboard, but it generates an "object reference not set on object instance" on the myReport.Dictionary.Variables["MyVar"].Value

Do Dashboards support the variables?

Do I need to load the dashboard inside a report like this

Code: Select all

var report = new StiReport();
report.Pages.Clear();

var dashboard = new StiDashboard();
report.Pages.Add(dashboard);
and assign the variables to the report?

Thank you

Re: Dashboard variables

Posted: Mon Feb 04, 2019 4:51 pm
by r.bianco
My bad, I should have used .Add() instead of accessing the array directly, I don't know how it even worked before ;)

Re: Dashboard variables

Posted: Mon Feb 04, 2019 9:17 pm
by Lech Kulikowski
Hello,

Ok. Thank you for the information.