Search code examples
ssrs-2008reportbuilder3.0

Concatenate Negative Number and String in SSRS


I'm having a trouble in concatenating the Negative numbers and Strings. I've successfully display the negative numbers with parenthesis (ex. (3)) but when I add the string to it the format of number becomes -3 again. This is my expression:

=Cint(Fields!UNT_TAKEN.Value) & " UNITS"

It returns me with this value -3 UNITS

But I want to return (3) UNITS

Thank you in advance.


Solution

  • If UNIT_TAKEN is already a number then you can just set the format property of the cell/textbox to

    0 Units;(0) Units
    

    If UNIT_TAKEN is a string then set the value expression of the cell/textbox to

    =FORMAT(CINT(Fields!UNIT_TAKEN.Value),"0 Units;(0) Units")
    

    Below I created a dataset with both a numeric and string version of seven numbers. The table below shows the actual values and the formatted values as above.

    enter image description here