Groups | Blog | Home
all groups > sql server reporting services > october 2006 >

sql server reporting services : Calling functions in an expression


Matt M
10/31/2006 1:55:02 PM
I have a function in the Report Code of one of my reports and an expression
that references it. Here is the expression that is in the details row:

=Iif(Code.Check(Fields!fullname.Value), 0,
Code.AddClient(Fields!fullname.Value))

The Check function basically looks in an array to see if the name is in the
array already. If it is, the expression should return 0. If it is not in the
array, it should call AddClient() to add the client and increment the
variable Total (Which is also declared in the Report Code). However, whenever
this expression runs, Total gets incrememnted no matter what. Even if the IIf
condition is false.

Amarnath
11/1/2006 5:54:01 AM
It is ok, is there any error in that case what exactly is the error?

Amarnath

[quoted text, click to view]
Matt M
11/1/2006 6:26:01 AM
There is no error, but rather this is what is being displayed in the report:

0 Case1
1 Case2
2 Case3
3 Case4
4 Case5

The first column displays the Total variable that gets incremented by the
AddClient() function. It should only be incremented if the Check() returns
true in any of the Cases. But instead, it gets incremented every row.


[quoted text, click to view]
Chris Conner
11/1/2006 12:24:17 PM
You still need to evaluate the expression... (i.e. you need an = sign)

change it to:

=Iif(Code.Check(Fields!fullname.Value) = 1, 0,
Code.AddClient(Fields!fullname.Value))

and I am assuming that you are returning a zero for false and 1 for true...

=-Chris

[quoted text, click to view]

Matt M
11/2/2006 6:11:02 AM
I'm actually returning a boolean true or false with it. I tried returning a 0
or a 1 and still does the same thing.

[quoted text, click to view]
Amarnath
11/2/2006 6:35:02 AM
It means it is always returning true... Try hard code just for testing
purpose. hard code it to false and see whether it increments.

Amarnath

[quoted text, click to view]
AddThis Social Bookmark Button