Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net SSRS-使用带有“的表达式”;如果;语句和多个参数值_Vb.net_If Statement_Reporting Services_Switch Statement_Ssrs 2016 - Fatal编程技术网

Vb.net SSRS-使用带有“的表达式”;如果;语句和多个参数值

Vb.net SSRS-使用带有“的表达式”;如果;语句和多个参数值,vb.net,if-statement,reporting-services,switch-statement,ssrs-2016,Vb.net,If Statement,Reporting Services,Switch Statement,Ssrs 2016,因此,我试图在SSRS中为一个包含4个用户参数字段的报告设置一些动态文本,但我一直遇到相同的错误。我对SSRS和visualbasic还很陌生,所以理解错误消息有点困难 System.Web.Services.Protocols.SoapException: The Value expression for the textrun ‘Textbox2.Paragraphs[2].TextRuns[1]’ contains an error: [BC33104] 'If' operator re

因此,我试图在SSRS中为一个包含4个用户参数字段的报告设置一些动态文本,但我一直遇到相同的错误。我对SSRS和visualbasic还很陌生,所以理解错误消息有点困难

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.
4个参数字段是beginYear、beginMonth、endYear和endMonth。以下是表达式中的代码:

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
因此,如果我从报告中选择以下参数,如下所示(在月参数中,我为月指定了数值):


我应该在报告文本框中看到以下表达式=>“2018年4月至6月第四季度”

这不是SSRS中的
If
格式。见下文:

=Iif(Parameters!yourParameter.Value = Parameters!yourAnotherParameter.Value, "value if true", "value if false")
对于您的情况,您应该使用
开关

=Switch(Parameters!yourParameter.Value = Parameters!yourAnotherParameter.Value 
        AndAlso Parameters!yourParameter.Value = "something else"
        AndAlso Parameters!yourParameter.Value = "again something else", "desired output if all condition are met", 
        Parameters!yourNextParameter.Value = Parameters!yourNextAnotherParameter, "desired output if this condition is met")

尝试添加然后语句。。。(eMonth=3)然后。。。(eMonth=6)然后。。。etcI认为在两个皈依者面前都有一个额外的括号。你的一年不是已经是整数了吗?为什么不呢<代码>((Convert.toInt32(bYear))=(Convert.toInt32(eYear))-1和((Convert.toInt32(eYear))=(Convert.toInt32(bYear))+1和(bmmonth=7)和(eMonth=6)我认为您的开关语法不正确。比较之后,如果结果为真,则应该有结果-可能是`…和其他参数!yourParameter.Value=“又是另一个”、“旧的”、“旧的”。公平地说,他确实提到了VB(虽然含糊不清)。感谢你指出这一点,我在我的示例的第一部分中添加了不止一个条件,这让我感到困惑。
=Switch(Parameters!yourParameter.Value = Parameters!yourAnotherParameter.Value 
        AndAlso Parameters!yourParameter.Value = "something else"
        AndAlso Parameters!yourParameter.Value = "again something else", "desired output if all condition are met", 
        Parameters!yourNextParameter.Value = Parameters!yourNextAnotherParameter, "desired output if this condition is met")