« Trouble with Assignment Units in Project 2010? | Main | VBA returns in Excel 2011 for Mac »

Project Server and Report Builder 3 Null Value Error

I've been building a few Project Server 2010 reports with Report Builder 3.0 lately and have had to deal with missing values in iif statements. Unfortunately you can't test for the missing data in the iif statement as it evaluates all the expressions first so you need to test for missing values earlier.

The easiest way to do this I've found is to use code in the Report definition. Right-clicking on the body of the report (not the table or chart) brings up the report properties. Clicking on the Code tab brings up a box where you can enter your custom code.

In this case I want to make sure that at least a 0 is returned so I wrote this function

public Function NullToZero(Byval x as long)
If not x > 0 then
return 0
else : Return x
End if
End Function

Then simply use the function in your expression like this:

=code.NullToZero(Fields!TaskWork.Value)
RELATED POSTS

Post a comment

(Comments are moderated to fight SPAM and will be published after I have a chance to approve them. Thanks for waiting.)

About

The previous article is Trouble with Assignment Units in Project 2010?.

The next article is VBA returns in Excel 2011 for Mac.

Current articles are in the main index page and you can find a complete list of articles in the archives.

Creative Commons License
This weblog is licensed under a Creative Commons License.
Powered by
Movable Type 3.34