Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 Development Tools
 Reporting Services Development
 Custom Code
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

1 Posts

Posted - 01/14/2013 :  01:12:39  Show Profile  Reply with Quote

Wrote a Custom Code i.e. a function.
Can not refer to this function from an expression area. It says unrecognized identifier.

Public dim pct_total as double
Public dim p_dept as string
Public dim p_rname as string
Public dim p_proj as string

Public function add_pct(byval dept as string,byval rname as string,byval proj as string,byval pct as double) as double

If p_dept <> dept or p_rname <> name or p_proj=proj then
End If


return pct

End Function

Public function get_total_pct() as double
return pct_total
end function



Any thought please ?

James K
Flowing Fount of Yak Knowledge

3873 Posts

Posted - 01/14/2013 :  03:01:41  Show Profile  Reply with Quote
I don't see anything obviously wrong with your report that can cause that error to be generated - unless you are using a custom assembly and not referencing the custom assembly. Compare what is described on this MSDN page to see which of the two approaches you are using -->

Another problem - although you have not run into it yet - is that if you are using SSRS 2008 or later global variables may not behave the way you expect them to. In 2008 and later, the order in which expressions are evaluated is not guaranteed. So the results you get may not be what you expect. A better option would be to use report variables or group variables if at all possible.
Go to Top of Page

Very Important crosS Applying yaK Herder

52326 Posts

Posted - 01/14/2013 :  03:22:10  Show Profile  Reply with Quote
sorry didnt understand why you want to nest functions like this. Why not return total from first function itself?

SQL Server MVP

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.1 seconds. Powered By: Snitz Forums 2000