Access Report Objects From Report Code

Stimulsoft Ultimate discussion
Post Reply
fritz
Posts: 2
Joined: Wed Nov 01, 2017 1:23 pm
Location: Mossel Bay, South Africa

Access Report Objects From Report Code

Post by fritz »

Good day,

We use the methods defined in the report code to populate variables defined in the report during report and page rendering. So far this solved a lot of our problems with shortcomings in the vendor provided business object data, but until now our requirements was to add variables to either header or footer section of the report, not to any detail section.

I would like to know if i can define and set a data source or business object from the Code page in the report template and maybe generate the business object data at runtime similar to how we are currently setting variable values. Unfortunately i cannot see that the Data Sources or Business Objects get exposed to the Code, all variables are accessible including any object on the template and even though the Databands are visible in the code as an object, i don't see any way of manipulating any of the databand's data.

Alternatively, similar to the variables in the header and footer sections being populated by a method called from the Rendering event, can i do the same with the detail bands? So far i could add a variable to the detail band and have the value populated with a value from my method in the Code section, but it seem that the same value for line 1 is being replicated to all detail lines, which make me believe that either the Databand Rendering event is not firing for each row or that my variable is being overwritten on all lines every time the method get called from the Rendering event.

Lastly, is there any suggestions on the most efficient way to add additional data to my report, especially detail list that need to be added to the current business object data?

And if you wonder why i am doing all this in the code section of the report, there is a very good reason to that, the current application in which the report run is still using the Silverlight version of Stimulsoft, in the Silverlight version i can not add ODBC connections, so the best workaround i could come up with, was C# approach from the code page.
Lech Kulikowski
Posts: 6247
Joined: Tue Mar 20, 2018 5:34 am

Re: Access Report Objects From Report Code

Post by Lech Kulikowski »

Hello,

Unfortunately, it is not possible to add/modify/remove data sources in events.

Thank you.
fritz
Posts: 2
Joined: Wed Nov 01, 2017 1:23 pm
Location: Mossel Bay, South Africa

Re: Access Report Objects From Report Code

Post by fritz »

Hi Lech,

I think you did not understand my question clearly, with Stimulsoft you have the option to add custom C# code as per attached screenshot, the methods in the code get executed with Events from the Report Page side. My question is how to gain access or expose Datasource, Business Objects or Databands in the Code section.

Hope the screenshot make my question more understandable.
Thanks
Attachments
StimulsoftCode.jpg
StimulsoftCode.jpg (486.88 KiB) Viewed 1719 times
Lech Kulikowski
Posts: 6247
Joined: Tue Mar 20, 2018 5:34 am

Re: Access Report Objects From Report Code

Post by Lech Kulikowski »

Hello,

The best way, it is save the report as .cs class then add to your project in VS and check all available, necessary objects.

Thank you.
Post Reply