Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Basim
Starting Member
1 Post |
Posted - 2013-01-14 : 01:12:39
|
Hi,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 doublePublic dim p_dept as stringPublic dim p_rname as stringPublic dim p_proj as stringPublic function add_pct(byval dept as string,byval rname as string,byval proj as string,byval pct as double) as doubleIf p_dept <> dept or p_rname <> name or p_proj=proj then pct_total=pct_total+pctEnd Ifp_proj=projp_dept=deptp_rname=rnamereturn pctEnd FunctionPublic function get_total_pct() as double return pct_totalend function=Code.add_pct(Fields!Departments.value,Fields!ResourceName.Value,Fields!ProjectName.Value,Fields.Percentage.Value)=Code.get_total_pct()Any thought please ? |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-01-14 : 03:01:41
|
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 --> http://msdn.microsoft.com/en-us/library/ms156028.aspxAnother 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. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-01-14 : 03:22:10
|
sorry didnt understand why you want to nest functions like this. Why not return total from first function itself?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|