Groups | Blog | Home
all groups > sql server reporting services > february 2005 >

sql server reporting services : global code


Bruce L-C [MVP]
2/4/2005 8:39:08 AM
You can have assemblies that are shared between reports. Search books on
line for custom code and it will tell you all about it.


--
Bruce Loehle-Conger
MVP SQL Server Reporting Services

[quoted text, click to view]

Bruce L-C [MVP]
2/4/2005 9:20:13 AM
I haven't done this but I think it would work. It looks to me that
report.rdl in this directory:
C:\Program Files\Microsoft SQL Server\80\Tools\Report
Designer\ProjectItems\ReportProject

Is what is used by the report wizard. My guess is if you change this then
all the new reports would have the code. Save a copy of it just in case. Let
me know if that works for you.


--
Bruce Loehle-Conger
MVP SQL Server Reporting Services


[quoted text, click to view]

Bruce L-C [MVP]
2/4/2005 10:25:12 AM
You are not being consistent here. On the one hand you said you understood
about using custom assemblies. On the other hand you posted this. Your code
can go in a custom assembly once. Then all you have to do is reference that
assembly in your reports. You do not have to have that function defined in
each and every report.

As I suggested before, read up on custom code. You can do custom code two
ways, code behind report and in your own assembly. What you are talking
about here is code behind report.

--
Bruce Loehle-Conger
MVP SQL Server Reporting Services

[quoted text, click to view]

Servé La
2/4/2005 1:19:20 PM
Is there a place where I can put custom code so that all reports in a
solution can access the same code?
I now copy the code into every new report I create

DaleG
2/4/2005 3:57:05 PM
Could you not store the function as a 'stored procedure' in the database
then just call the stored procedure as you need it?

Dale


[quoted text, click to view]

Servé La
2/4/2005 4:02:38 PM

"Bruce L-C [MVP]" <bruce_lcNOSPAM@hotmail.com> schreef in bericht
news:%2393IKdsCFHA.3376@TK2MSFTNGP12.phx.gbl...
[quoted text, click to view]

Thats not what I meant. The code for calling the assemblies will have to be
duplicated in every report one creates.

Frank Matthiesen
2/4/2005 4:26:38 PM
[quoted text, click to view]

I did'nt understand your question. Each report is like a single programm.
If i need an assembly in two programms, i have to write
IMPORTS myassemblyclass
in BOTH programms


frank

Servé La
2/4/2005 4:43:07 PM

"Frank Matthiesen" <fm@xax.de> schreef in bericht
news:36hi9eF50g2hqU1@individual.net...
[quoted text, click to view]

Suppose you have created a component where you have to set a few properties
and then calculate some value.
You create a function for this like the following:

Function Compute(name as String, x as Integer, y as Integer, z as Integer)
as Integer
Dim obj as new MyComponents.Component(name)

obj.X = x
obj.Y = y
obj.Z = z

Try
Compute = obj.Compute()
Catch e as OopsException
Compute = -1
End Try

End Function

You then want to use this function in a few reports. Right now I see no
other way then to put that code in every report and call it, while I
expected to put that function somewhere globally where all reports could
access it. In reality the code gets a lot more complex very fast.

BruceLC
2/7/2005 7:52:42 AM
You are still missing the point. You can have code behind and you can have
custom assemblies. You can definitely put your common functions in a custom
assembly that all your reports will use. You can have both code behind and
custom assemblies. The tricky part of custom assemblies is deployment of the
assembly.


--
Bruce Loehle-Conger
MVP SQL Server Reporting Services

[quoted text, click to view]

Servé La
2/7/2005 8:25:04 AM

"Bruce L-C [MVP]" <bruce_lcNOSPAM@hotmail.com> schreef in bericht
news:uvhbbYtCFHA.2540@TK2MSFTNGP09.phx.gbl...
[quoted text, click to view]

I guess I meant code behind then. I have some cases where methods need to be
called from code behind in a certain order so it would be nice to have this
functionality in one single function defined somewhere globally.
I take it the answer is "no you cant do this" then :)

Servé La
2/7/2005 4:05:57 PM

"BruceLC" <brucelc@newsgroup.nospam> schreef in bericht
news:OOGvMxRDFHA.1040@TK2MSFTNGP09.phx.gbl...
[quoted text, click to view]

I am talking about calling a custom assembly from code behind! It's about
both!!
The methods in the custom assembly need to be called within a certain order
so this has to be done in code behind.

Alexandre Mineev [MSFT]
2/9/2005 11:50:12 AM
Try putting your common code in a custom assembly and then placing it into
GAC

--
Alex Mineev
Software Design Engineer. Report expressions; Code Access Security; Xml;
SQE.

This posting is provided "AS IS" with no warranties, and confers no rights

[quoted text, click to view]

AddThis Social Bookmark Button