Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Report Viewer - Matrix
Message
De
06/01/2010 16:32:22
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01442494
Message ID:
01442501
Vues:
40
>Hi Friends,
>
>I am using the Report Viewer with Matrix Layout
>
>I want to post in the last column a calculated field with my own formula
>
>Unhappy the Report Viewer is making a sum
>
>Someone can help me ?
>
>Thanks in advance,
>
>Dionísio

I haven't done any matrix reports yet, but this works in other cells/fields in the SSRS reportviewer control:

Under Report Properties, Code tab, create a custom function (here is a dummy example):

FUNCTION MyCustomFunction(Value as INTEGER) AS INTEGER
RETURN Value * 2
END FUNCTION

Then, call that function in the report by using the “Code” keyword like:

Code.MyCustomFunction(10)

That calls the function at runtime and will use the output returned.

Another option is to use a function that is inside of a class in an assembly. To do that, you have to add a reference to that assembly to your report assembly. Then specify the name of the class under the references tab of the Report Properties in the classes area. You also have to specify the name of the object under InstanceName (for example myObject below). Then all that is left is to use that object when you call the function:

Code.myObject.MyCustomFunction(10)

I just tested this on a dummy report and it works. I used this as the field value in one field in a table:

=STR(Code.MyCustomFunction(=Fields!IDKey.Value))

That takes the IDKey field value and passes it to MyCustomFunction which then returns its value*2 and it worked by displaying each row's IDKey.Value*2 in every row in the table correctly.


Hope that helps,
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform