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

284 Views Asked by At

I'm working on an ssrs report using Report builder 2008, currently trying to concatenate using something like this but when I do so, I receive an error for the field 'lifeamount' specifying that the expression can only refer to fields within the current dataset scope. I've tried different ways to specify the dataset which is the same for all the fields but to no avail. Is this even possible?

=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"))

2

There are 2 best solutions below

0
iamdave On BEST ANSWER

SSRS expressions are case sensitive which means that your second lifeamount reference is more than likely wrong.

Try this instead:

=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"))
0
Alan Schofield On

If the expression is located in a cell that is within the same scope as the details you are fetching (i.e. "EmployeeInfo") then I don't think you need to specify it at all.

Also there are some brackets out of place I think. I can't test it at the moment but try this...

=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"))