method GetDataListFromDataColumn() not returning values

Stimulsoft Reports.NET discussion
Post Reply
deestinee
Posts: 11
Joined: Tue Dec 17, 2019 7:26 am

method GetDataListFromDataColumn() not returning values

Post 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
Attachments
Report_test.mrt
(14.01 KiB) Downloaded 178 times
Novy1.xml
(4.16 KiB) Downloaded 189 times
Lech Kulikowski
Posts: 7341
Joined: Tue Mar 20, 2018 5:34 am

Re: method GetDataListFromDataColumn() not returning values

Post by Lech Kulikowski »

Hello,

Sorry, maybe we did not exactly understand your issue. Could you explain your task in more detail?

Thank you.
deestinee
Posts: 11
Joined: Tue Dec 17, 2019 7:26 am

Re: method GetDataListFromDataColumn() not returning values

Post 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
Lech Kulikowski
Posts: 7341
Joined: Tue Mar 20, 2018 5:34 am

Re: method GetDataListFromDataColumn() not returning values

Post 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.
Post Reply