SQL Server Performance Forum – Threads Archive
Executing Custom FunctionsHave created a namespace that contains a class with my personnal functions for various
string manulations. Have one called secsToHMS() within the class of MyRptFx within the namespace dmatta under the project MyFx. Have my reporting project called report project1 and have included the class as another project. Within a matrix cell, the function is called: =dmatta.myrptfx.secsToHMS(param) When building, it doesn’t recognize the reference. I believe that this is possible?
If it is then what might I be missing? THanxs,
Are you talking about this functionality http://msdn.microsoft.com/library/default.asp?url=/library/en-us/RSPROG/htm/rsp_prog_rdl_4lps.asp as opposed to code you are include in the Code section of a report ? HTH Jasper Smith
Have tried this approach. It is using a static member of a newly created class with a namespace of dmatta. When compiling, the expression doesn’t recognize the namespace. Have tried a number of variations but can’t seem to identify the problem. Any suggestions? Thanxs,
Please verify that this is the right approach. To add a reference to a web project, one would need to: 1) Created a namespace and class using a ClassLibrary template.
Solution name: MyLib
Project Name : MyLib
VB Code Name: MyRptFx.vb Within VB Code, have the following which builds with no problem: namespace dmatta
public class MyRptFx Public shared Function SecsToHMS(byVal secs as Long) as String
SecsToHMS = strout
end namespace 2) Under the solution Report Project 1, have two projects.
a) Web application porject call Report Project1.
b) Vb Application called MyLib which was added to Report Projects as an
c) Added a reference to the to MyLib using the MyLib.dll Using expression as =dmatta.MyRptFx.SecsToHMS…..
Build Fails with dmatta not defined. Am I adding the reference to the MyLib dll properly??? Any suggestions appreciated. Thanxs,
These are the steps I took to do this<br /><br />1) Create a brand new project that is a VB Class Library<br />2) Give it a root namespace of RSTest<br />3) Add the following code<pre>Public Class RSClass<br /><br /> Public Shared Function RSAdd4(ByVal i As Integer) As Integer<br /> Return (i + 4)<br /> End Function<br /><br />End Class</pre><br />4) Build the solution<br />5) Copy the output (RSTest.dll) to the following folders<br />Crogram FilesMicrosoft SQL ServerMSSQLReporting ServicesReportServerin<br />Crogram FilesMicrosoft SQL Server80ToolsReport Designer<br />6) Create a brand new Reporting Services Project<br />7) Add a new Report<br /><img src=’/community/emoticons/emotion-11.gif’ alt=’8)’ /> In the Report>Report Properties Menu select the References Tab and browse to the output of my Class Library project and select RStest.dll<br />9) In an expression in the Report call it like so<pre>=RSTest.RSClass.RSAdd4(Fields!qty.Value)</pre><br />10) Deploy the report to the server<br /><br /><br />HTH<br /><br />Jasper Smith
Jasper, Suppose I already have a reporting services solution with a project in it and two reports. Is there a way to do this with
existing reports? Currently viewing report properties for r100Perf.rdl and it displays the fullPath and Name. There is no reference tab…
When a new report is added and the properties viewed there still is no reference tab….
I looking in the right place? dmatta
Not quite [<img src=’/community/emoticons/emotion-1.gif’ alt=’‘ />]<br />With Report Designer open, open an existing report and choose the Layout Tab. Click anywhere on the layout and you should see a Report menu item in the top menu of Visual Studio. For example, my top menu in VS looks like<br /><br />File Edit View Project Build Debug Format Report Tools Window Help<br /><br />You want the Report menu and then choose Report Properties and you should see the References Tab on that<br /><br /><br />HTH<br /><br />Jasper Smith
Will try and let you know. Have a subsequent question…. Was trying to add the dll by adding the class library project to the report solution. It can be done with other .Net development. Is it not possible with Reports server? Thanxs,
I don’t see ahy you can’t do this to kepp the dll and the reports it depends on together but Report Designer won’t deploy the dll for you so you still need to copy it to the locations indicated in my previous reply plus the dll has to exist and be references before you can use it in your report. I don’t think it matters, I was just keeping them separate to (hopefully) make the walkthrough clearer [<img src=’/community/emoticons/emotion-2.gif’ alt=’‘ />]<br /><br /><br />HTH<br /><br />Jasper Smith
Appreciate the information and feel much better since adding the project would work as a declaration and distribution of the .dll in .NET but now know not in reports server….<br /><br />Thanxs, <br />dmatta<br /><br /><img src=’/community/emoticons/emotion-1.gif’ alt=’‘ /> <img src=’/community/emoticons/emotion-1.gif’ alt=’‘ /><br />