Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Identifier expected error trying to deploy SSRS project with custom code

I have a project with this custom code:

Public Function GetStdDev(ByVal Sum1 as Integer, ByVal Sum2 as Integer, 
                                          ByVal Sum3 as Integer, ByVal Sum4 as Integer,
                                          ByVal Sum5 as Integer, ByVal WAvg as double) as Double
   Dim aleph = 5/60
   Dim w1 = (Sum1 - WAvg)^2 
   Dim w2 = 2 * ((Sum2 - WAvg)^2)
   Dim w3 = 3 * ((Sum3 - WAvg)^2)
   Dim w4 = 4 * ((Sum4 - WAvg)^2)
   Dim w5 = 5 * ((Sum5 - WAvg)^2)
   Dim alpha = (w1 + w2 + w3 + w4 + w5) / 5
   Dim beta = sqrt(alpha * aleph)
   Return beta
End Function

The report can be previewed just fine, but when I deploy it, I get this error:

There is an error on line 0 of custom code: [BC30203] Identifier expected.  

I have no idea what SSRS's problem is. Can anyone enlighten me?

Thanks!

like image 959
Michael Robinson Avatar asked May 12 '14 20:05

Michael Robinson


1 Answers

This is a classic case of rule #1 of programming: "I'm a dumbass". The problem is I did not put in the underscores on the function declaration as I forgot you had to do that in VB. Why the preview did not complain, I will never know. The corrected code is:

Public Shared Function GetStdDev(ByVal Sum1 as Integer, ByVal Sum2 as Integer, _ 
                                          ByVal Sum3 as Integer, ByVal Sum4 as Integer, _
                                          ByVal Sum5 as Integer, ByVal WAvg as double)     as Double
   Dim aleph as double = 5/60
   Dim w1 as double  = (Sum1 - WAvg)^2 
   Dim w2 as double = 2 * ((Sum2 - WAvg)^2)
   Dim w3 as double = 3 * ((Sum3 - WAvg)^2)
   Dim w4 as double = 4 * ((Sum4 - WAvg)^2)
   Dim w5 as double = 5 * ((Sum5 - WAvg)^2)
   Dim alpha as double = (w1 + w2 + w3 + w4 + w5) / 5
   Dim beta as double = sqrt(alpha * aleph)
   Return beta
End Function
like image 158
Michael Robinson Avatar answered Oct 20 '22 21:10

Michael Robinson