Accessing other data source from data band

Stimulsoft Reports.NET discussion
Post Reply
ColinM
Posts: 12
Joined: Wed Oct 01, 2008 9:28 am

Accessing other data source from data band

Post by ColinM »

Hi,

For each row of data printed in a data band (for data source X), I need to look up a row in data source Y. My question is, is it possible to add a function to the BeforePrintEvent of the data band (X) which will return data from Y? To do this, I will need to filter Y by a key value from X - can I access rows / filter an STI data source using ADO.NET type methods?

Thanks,
Colin
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Accessing other data source from data band

Post by Edward »

Hello, Colin.

If it is possible you can create a relation between datasources (if they are from different datasources then you have to set Report.CacheAllData property in true).

Work on the ADO.Net level is also possible. Each DataSource has DataTable property which represents ADO.Net standard DataTable object and this DataTable contains all the data of that DataSource.

Thank you.
ColinM
Posts: 12
Joined: Wed Oct 01, 2008 9:28 am

Accessing other data source from data band

Post by ColinM »

Thank you Edward, I will give this a try.

Colin
ColinM
Posts: 12
Joined: Wed Oct 01, 2008 9:28 am

Accessing other data source from data band

Post by ColinM »

Hi,

In the code for the mrt I have the following:

Dim dtLevel As Data.DataTable
Dim drRows() As Data.DataRow

dtLevel = Level.DataTable
drRows = dtLevel.Select("levelName = 'XXX'")

The business object data source is 'Level'. The assignment to dtLevel works ok, however, the mrt is falling over on the final dtLevel.Select line. The column name is definately correct. Could you tell me where I am going wrong here please?

Thanks,
Colin
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Accessing other data source from data band

Post by Edward »

Hi, Colin.

Your steps are absolutely correct. If you have no idea what is wrong, feel free to submit your application and data for it to support[at]stimulsoft.com.

Thank you.
ColinM
Posts: 12
Joined: Wed Oct 01, 2008 9:28 am

Accessing other data source from data band

Post by ColinM »

Hi Edward,

I stored the exception message in a variable which I then displayed in a text box in the report, and the problem was that the column name could not be found. The column name is definately correct, so I set the text box to display the column names from the 'Level' datatable. Much to my surprise, the 'Level' datatable contains column names for a completely different data source, the 'Vendors' business object data source.

How is it possible for the datatable for data source X to contain column names for data source Y, and how can I correct this?

Many thanks,
Colin
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Accessing other data source from data band

Post by Edward »

Hello, Colin.

Could you please send this report to support[at]stimulsoft.com for analysis.

Thank you.
ColinM
Posts: 12
Joined: Wed Oct 01, 2008 9:28 am

Accessing other data source from data band

Post by ColinM »

OK, will do.

Thanks,
Colin
Post Reply