Concatenate fields with comma

Hi Friends

How to write a expression to achieve the following task in SSRS:

Col_1  Col_2  Col_3  Col_4

  A           B        NULL     D

  A           B          C       NULL

To        A, B, C

            A, B, C

I wrote a expression like this: =Fields!Col_1.value & "," & Fields!Col_2.value & "," & Fields!Col_3.value & "," & Fields!Col_4.value

and I'm getting result like this: A, B, , D (as Col_3 is NULL)

       A, B, C, (getting comma after C as Col_4 is NULL).

February 8th, 2015 7:05pm

you can make expression like this

=Fields!Col_1.value & IIF(Len(Fields!Col_2.value) = 0 ,"","," & Fields!Col_2.value) & IIF(Len(Fields!Col_3.value) = 0 ,"","," & Fields!Col_3.value) & IIF(Len(Fields!Col_4.value) = 0 ,"","," & Fields!Col_4.value)

Free Windows Admin Tool Kit Click here and download it now
February 9th, 2015 12:00am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics