Page 1 of 1

Using static methods in a report

Posted: Mon May 21, 2007 6:31 am
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.

Using static methods in a report

Posted: Mon May 21, 2007 11:33 am
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.

Using static methods in a report

Posted: Mon May 21, 2007 12:54 pm
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.