Using static methods in a report

Stimulsoft Reports.NET discussion
Post Reply
Martin Hart Turner
Posts: 66
Joined: Wed Apr 04, 2007 3:32 am
Location: Spain

Using static methods in a report

Post by Martin Hart Turner »

Hi:

I'm sure this is an easy question for the gurus out there...

How can I use static function to calculate a total within a report?

What I'm trying to do is use a static function I have in C# to do some pretty sofisticated calculations and then return the result to be printed in the report, in a detail band.

Also, the static function requires a few parameters to identify the record it should do the calculations for, which should be provided by the current record withint the report. How do I access this data to pass to my code?

Finally, where should I be doing this (maybe an event handler)?

TIA,
MartinH.
Guest
Posts: 182
Joined: Tue Jun 06, 2006 8:04 am

Using static methods in a report

Post by Guest »

MartinH wrote:How can I use static function to calculate a total within a report?
What I'm trying to do is use a static function I have in C# to do some pretty sofisticated calculations and then return the result to be printed in the report, in a detail band.
You should do the following steps:
1. Define your static function in the program code. The result of the calculating please store in the variable which should be defined in the Dictionary of the report. After the calculations the result can be rendered in the detail band from the variable.
MartinH wrote:Also, the static function requires a few parameters to identify the record it should do the calculations for, which should be provided by the current record withint the report. How do I access this data to pass to my code?
2. In the report please add the reference to your program (Properties - Referenced Assemblies) and a namespace.
Please, see the flash demo "How to add My Function" on our site.
http://www.stimulsoft.com/livedemos/Rep ... ction.html
MartinH wrote:Finally, where should I be doing this (maybe an event handler)?
3. You can call your function in the Rendering event of the report using DataSource.Position or Line function, which specify position of the record in a datasource.

Thank you.
Martin Hart Turner
Posts: 66
Joined: Wed Apr 04, 2007 3:32 am
Location: Spain

Using static methods in a report

Post by Martin Hart Turner »

Pavel:

That was spot on, problem resolved.

It takes a little time to understand the philosophy of a new product, but I'm getting there.

Thanks again,
Martin.
Post Reply