Array of objects as data source

Stimulsoft Dashboards.JS discussion
Post Reply
jhiben
Posts: 3
Joined: Sat Jul 20, 2019 2:12 pm

Array of objects as data source

Post by jhiben »

Hi,

I'm working on a report which needs to load some arbitrary data. I've prepared the report template with ASP.NET Core and configured several business objects that I load into the report when I want to view/render it.

However, when I tried to use this template with the JS library, nothing was working anymore (even though there is a regbusinessobject function on the report object). I've checked this forum and some posts clearly indicate that business objects are not supported in the JS library.

So here is my question: what is the best way to load an array of custom objects in a report with the JS library ? I need the final template to be compatible with the JS and the .NET Core libraries (that is, to be able to render the report on both the browser and the server).

Thanks in advance for your help.
Lech Kulikowski
Posts: 6243
Joined: Tue Mar 20, 2018 5:34 am

Re: Array of objects as data source

Post by Lech Kulikowski »

Hello,

Unfortunately, business objects are not supported in the JS version.

As a way, you can try to implement your own custom adapter. You can find a sample at the following link:
https://github.com/stimulsoft/Samples-J ... apter.html

Thank you.
jhiben
Posts: 3
Joined: Sat Jul 20, 2019 2:12 pm

Re: Array of objects as data source

Post by jhiben »

Thank you for your answer.

So, just to be sure, there is no built-in way to load an array of objects in a report with the JS library?
Lech Kulikowski
Posts: 6243
Joined: Tue Mar 20, 2018 5:34 am

Re: Array of objects as data source

Post by Lech Kulikowski »

Hello,

Unfortunately, no, there are no other ways. Sorry.

Thank you.
jhiben
Posts: 3
Joined: Sat Jul 20, 2019 2:12 pm

Re: Array of objects as data source

Post by jhiben »

All right, thanks.

For the record, I have finally found a solution that works on both side, using a DataSet: in JS, the Stimulsoft library contains an implementation that can load some JSON, and in .NET one can easily convert an object to a System.Data.DataSet (using JsonConvert for example). This dataset can then be used as a DataSource in the report.
Lech Kulikowski
Posts: 6243
Joined: Tue Mar 20, 2018 5:34 am

Re: Array of objects as data source

Post by Lech Kulikowski »

Hello,

Thank you for the provided information.
Post Reply