lundi 27 août 2018

SSRS - Using Expressions with "If" statements and multiple parameter values

So I'm trying to set up some dynamic text for a report in SSRS with 4 user parameter fields and I keep running into the same error. I'm still pretty new to SSRS and Visual Basic, so it's a bit hard to understand the error message.

System.Web.Services.Protocols.SoapException: The Value expression for the textrun 
‘Textbox2.Paragraphs[2].TextRuns[1]’ contains an error: [BC33104] 'If' operator
requires either two or three operands.

The 4 parameter fields are beginYear, beginMonth, endYear, & endMonth. The following is the code I have in the expression:

If (bYear = eYear) And (bMonth = 1) And (eMonth = 3)
"3rd Quarter January - March " & eYear

ElseIf  (bYear = eYear) And (bMonth = 4) And (eMonth = 6)
"4th Quarter April - June " & eYear

ElseIf  (bYear = eYear) And (bMonth = 7) And (eMonth = 9)
"1st Quarter July - September " & eYear

ElseIf  (bYear = eYear) And (bMonth = 10) And (eMonth = 12)
"2nd Quarter October - December " & eYear

ElseIf  (bYear = eYear) And (bMonth = 1) And (eMonth = 12)
"Calendar Year " & eYear

ElseIf  (bYear = eYear) And (bMonth = eMonth)
eYear & " " & eMonth 

ElseIf  (((Convert.toInt32(bYear)) = (Convert.toInt32(eYear)) - 1) And (((Convert.toInt32(eYear)) = (Convert.toInt32(bYear)) + 1) And (bMonth = 7) And (eMonth = 6)
"Fiscal Year " & bYear & "-" & eYear

Else
             bMonth & " " & bYear & "-" & eMonth & " " & eYear
End If

So if I selected the following parameters from the report as follows (in the month parameters, I assigned numerical values to months):

-Begin Year=2018
-Begin Month=April
-End Year=2018
-End Month=June

I should see the following expression in the text box of the report => "4th Quarter April - June 2018"

Aucun commentaire:

Enregistrer un commentaire