Page 1 of 1
method GetDataListFromDataColumn() not returning values
Posted: Mon Jan 25, 2021 11:17 am
by deestinee
Hello,
I am having trouble with GetDataListFromDataColumn() method. It´s returning values only if it´s called in Events. Otherwise it is returning null. Is there a way to use this method without an Event?
As attachments there is a test report and XML file containing data.
I am using GetDataListFromDataColumn() method in public Report().
Thank you, Filip
Re: method GetDataListFromDataColumn() not returning values
Posted: Wed Jan 27, 2021 8:35 am
by Lech Kulikowski
Hello,
Sorry, maybe we did not exactly understand your issue. Could you explain your task in more detail?
Thank you.
Re: method GetDataListFromDataColumn() not returning values
Posted: Wed Jan 27, 2021 12:55 pm
by deestinee
Hello,
sure. I have a public static List <object> called "Rep", which I want to populate with GetDataListFromDataColumn() method.
Now, I have this method, which should populate List "Rep" with data from "Data.ColData1".
Code: Select all
public Report()
{
this.AddData();
this.InitializeComponent();
Rep = Stimulsoft.Report.Dictionary.StiDataColumn.GetDataListFromDataColumn(this.Dictionary, "Data.ColData1");
}
When I try to acces Rep[0] later in code it is null. But If I populate List "Rep" in GetValue Event, it´s populated correctly:
Code: Select all
public void Text1__GetValue(object sender, Stimulsoft.Report.Events.StiGetValueEventArgs e)
{
Rep = Stimulsoft.Report.Dictionary.StiDataColumn.GetDataListFromDataColumn(this.Dictionary, "Data.ColData1");
e.Value = ToString(Rep[0]);
}
I need to populate List "Rep" globaly, so I could access it within text components. For example I would like to use:
Code: Select all
Text1.Width = double.Parse(Rep[0].ToString())
Thank you, Filip
Re: method GetDataListFromDataColumn() not returning values
Posted: Mon Feb 01, 2021 10:49 am
by Lech Kulikowski
Hello,
The data is connected only during the rendering of the report, before and after the data is disabled. If you need to get the data outside the rendering - the easiest way is to connect the dictionary:
Dictionary.Connect();
Rep = .....GetDataListFromDataColumn(this.Dictionary, "Data.ColData1");
Dictionary.Disconnect();
Thank you.