可以将多个字段与一个条件 if 语句连接起来

Is possible to concatenate multible fields with one that is a conditional iif statement

我正在使用 Report builder 2008 处理 ssrs 报告,目前正在尝试使用类似这样的东西进行连接,但是当我这样做时,我收到字段 'lifeamount' 的错误,指出表达式只能引用当前数据集范围内的字段。我尝试了不同的方法来指定所有字段都相同的数据集,但无济于事。这可能吗?

=rtrim(First(Fields!FRSTNAME.Value,"EmployeeInfo")) & " " & rtrim(First(Fields!MIDLNAME.Value, "EmployeeInfo")) & " " & rtrim(First(Fields!LASTNAME.Value, "EmployeeInfo")) & " " & IIF((Fields!Lifeamount.Value)> 100000.00, 100000.00, Fields!lifeamount.value, "EmployeeInfo"))

SSRS 表达式区分大小写,这意味着您的第二个 lifeamount 参考很可能是错误的。

试试这个:

=rtrim(First(Fields!FRSTNAME.Value,"EmployeeInfo")) & " " &
rtrim(First(Fields!MIDLNAME.Value, "EmployeeInfo")) & " " &
rtrim(First(Fields!LASTNAME.Value, "EmployeeInfo")) & " " &
IIF((Fields!Lifeamount.Value)> 100000.00, 100000.00, Fields!Lifeamount.value, "EmployeeInfo"))

如果表达式位于与您正在获取的详细信息相同范围内的单元格中(即 "EmployeeInfo"),那么我认为您根本不需要指定它。

我认为还有一些括号不合适。我现在无法测试,但试试这个...

=rtrim(First(Fields!FRSTNAME.Value,"EmployeeInfo")) & " " & 
rtrim(First(Fields!MIDLNAME.Value, "EmployeeInfo")) & " " &
rtrim(First(Fields!LASTNAME.Value, "EmployeeInfo")) & " " &
IIF((Fields!Lifeamount.Value, "EmployeeInfo")> 100000.00, 100000.00, (Fields!Lifeamount.value, "EmployeeInfo"))