Wednesday, March 21, 2012

Name cannot begin with the '>' character, hexadecimal value 0x3E

Hi,

This is my first attempt at SSRS, I've added code section to the xml file. But when I use <> for not equal to, it is giving me this error. What should I do? The code is as posted here.

Thanks,

Debi

***************************************************************************************

<Code>
Dim PrevId as Object
Dim a_Count As Double
Dim b_Count As Double
Dim c_Count As Double
Dim d_Count As Double
Dim e_Count As Double
Dim Total As Double = 0
Function SumMPCount(ByVal CurrID As Object,ByVal code As Object, ByVal NewCount As Object) As Double

If(CurrID is Nothing or code is Nothing or NewCount is Nothing)Then
Exit Function
End if
If PrevId Is Nothing Then
PrevId = CurrId
End if
If CurrID <> PrevID Then
a_Count = 0
b_Count = 0
c_Count = 0
d_Count = 0
e_Count = 0
Total = 0
End if
Select Case mp_Code
Case "a"
a_Count = a_Count + NewCount
SumMPCount = a_Count
case "b"
b_Count = b_Count + NewCount
SumMPCount = b_Count
case "c"
c_Count = c_Count + NewCount
SumMPCount = c_Count
case "d"
d_Count = d_Count + NewCount
SumMPCount = d_Count
case "e"
Total = a_Count + b_Count + c_Count + d_Count + e_Count
SumMPCount = Total
case else
e_Count = e_Count + NewCount
SumMPCount = e_Count
End Select

PrevId = CurrId
End Function
</Code>

It looks like you directly copy&pasted the code snippet into the RDL(XML) file and therefore the <> is not encoded an is interpreted as invalid xml element.

You have two options - either copy&paste the code snippet into the report designer custom code window (and report designer will automatically encode the characters correctly), or replace the <> in the RDL file with &lt;&gt; (which is the encoded representation).

-- Robert

|||

Thanks for the reply. Where is the custom code window? When I right click on the report and select properties, it just shows me the usual Properties tab on the RHS which shows background color, image, etc..

I actually worked around it using Object variables and using "Is" instead of <> .

|||I think he might have meant
right click on the report.rdl -> Prooperties -> Code tab -> paste theresql

No comments:

Post a Comment