Search code examples
reporting-servicessql-server-data-tools

SSRS SSDT I am trying to display a 2nd field (from the same dataset) in a matrix, in the same column


Interesting problem I've been stuck on because it seems so simple.

I am using Visual Studio 2010

=Fields!AccountName.Value & Fields!LeaveName.Value

Looking to pull in the LeaveName

My example should display Leave without Pay: Salary Savings

The field Leave without Pay is from (AccountName.Value) if there is data from there I would like the expression to add a colon (:) if there is a 2nd value coming, 2nd value Salary Savings is from (LeaveName.Value)

prior to posting my question I had tried

=Fields!AccountName.Value + IIF(IsNothing(Fields!LeaveName.Value),": ", "")

which gave no error an also did not pull in the data. I have a test example where I know the person has used Leave without pay: Salary Savings

FIX. added below expression to text box properties

=Fields!AccountName.Value + iif(IsNothing(Fields!LeaveName.Value),"",": "+Fields!LeaveName.Value)

additionally needed to play with Row Groups then went to Tablix properties 1. Filter Tablix. a. expression =Fields!AccountName.Value + Fields!LeaveName.Value b. <> Leave with Pay c. expression =Fields!AccountName.Value + Fields!LeaveName.Value d. <> Leave without Pay


Solution

  • Seems like it's simply:

    =Fields!AccountName.Value + iif(IsNothing(Fields!LeaveName.Value),"",": "+Fields!LeaveName.Value)
    

    or if that doesn't match anything, maybe this:

    =Fields!AccountName.Value + iif(Trim(Cstr(Fields!LeaveName.Value))="","",": "+Fields!LeaveName.Value)