Monday, March 26, 2012

getting started with custom assemblies

Hi All,
I've decided to try developing some custom assemblies for performing
calculations like variance to keep the code in the report simpler.
On page 154 of the WROX RS book it says that RSReportDesigner.config
and RSReportServer.config should have entries in them that are
commented out for <CustomAssemblies>...
But when I look at my two files there are no such xml tags..
Should I just add them? Can I do any damage? Or have customassemlies
been turn on by default?
Thanks
PeterIn case it helps get me (and others) started..
I created a simple class..
Public Class IBIRSClass
Public Shared Function CalcVariancePercentage(ByVal Plan As Double,
ByVal Actual As Double) As Double
Dim Variance As Double
Variance = 0
If Plan = 0 Or Actual = 0 Then
Return 0
Else
Variance = (Plan - Actual) / Plan
Return Variance
End If
End Function
End Class
I copied the dll across to \Reporting Services\ReportServer\bin
I added the reference by going into report->options->references and
browsing to \Reporting Services\ReportServer\bin to put the new class
into the report.
I put the following text into a cell...
=IBIRSCustomClass.IBIRSClass.CalcVariancePercentage(sum (
Fields!resp_tot_plan_amount.Value ) , sum(
Fields!resp_tot_act_amount.Value ) )
And when I build I get
Error while loading code module: 'IBIRSCustomClass,
Version=1.0.2086.34706, Culture=neutral, PublicKeyToken=null'.
Details: File or assembly name IBIRSCustomClass, or one of its
dependencies, was not found.
The value expression for the textbox 'textbox131' contains an
error: [BC30451] Name 'IBIRSClass' is not declared.
Build complete -- 2 errors, 0 warnings
Of course, there may be a few problems..
Firstly, what is the data type of a number passed to a function like
this? Is it really double?
And do I need to put the xml tags mentioned above into the config files
to make this work...I haven't yet...
Thanks
Peter|||Peter,
I am having the same problem. I have been able to find some MSDN articles on
this, but none explaining why it fails.
I am using a C# assembly, is that the same as yours?
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/RSPROG/htm/rsp_prog_rdl_4lps.asp
"Peter Nolan" wrote:
> In case it helps get me (and others) started..
> I created a simple class..
> Public Class IBIRSClass
>
> Public Shared Function CalcVariancePercentage(ByVal Plan As Double,
> ByVal Actual As Double) As Double
> Dim Variance As Double
> Variance = 0
> If Plan = 0 Or Actual = 0 Then
> Return 0
> Else
> Variance = (Plan - Actual) / Plan
> Return Variance
> End If
>
> End Function
> End Class
> I copied the dll across to \Reporting Services\ReportServer\bin
> I added the reference by going into report->options->references and
> browsing to \Reporting Services\ReportServer\bin to put the new class
> into the report.
> I put the following text into a cell...
> =IBIRSCustomClass.IBIRSClass.CalcVariancePercentage(sum (
> Fields!resp_tot_plan_amount.Value ) , sum(
> Fields!resp_tot_act_amount.Value ) )
> And when I build I get
> Error while loading code module: 'IBIRSCustomClass,
> Version=1.0.2086.34706, Culture=neutral, PublicKeyToken=null'.
> Details: File or assembly name IBIRSCustomClass, or one of its
> dependencies, was not found.
> The value expression for the textbox 'textbox131' contains an
> error: [BC30451] Name 'IBIRSClass' is not declared.
> Build complete -- 2 errors, 0 warnings
> Of course, there may be a few problems..
> Firstly, what is the data type of a number passed to a function like
> this? Is it really double?
> And do I need to put the xml tags mentioned above into the config files
> to make this work...I haven't yet...
> Thanks
> Peter
>|||Hi Ben,
I am using vb.net...I got this to work without the changes to the
config files.....in the end all I am doing is putting the custom
assemblies into the correct directories on the new CTP...I can dig out
the correct names as they are on a different PC..
Peter

No comments:

Post a Comment