Search code examples
c#reporting-servicesssrs-2008rdlc

cdec function doesn't work if value type is html in rdlc report c#


The following value expression for placeholder works in html type input in the table header

= Sum(CDec(Fields!TotalDueAmount.Value))

But when I change it to concatenate a string it doesn't work. I tried below both of them shows #Error

= "Total: " + Sum(CDec(Fields!TotalDueAmount.Value))

= "<b>" + First(Fields!TotalLabel.Value, "ModelData") + ": "  + "</b>" +  Sum(Fields!TotalDueAmount.Value, "ModelData")

Solution

  • You need to convert the sum back to a string to concatenate it with other strings:

    = "Total: " + CStr(Sum(CDec(Fields!TotalDueAmount.Value)))
    

    An even better option is to use a placeholder. Type "Total: " in the textbox and then right-click in the textbox after it. Select the option to create a placeholder. Set the Value to Sum(CDec(Fields!TotalDueAmount.Value)). Now you can adjust the number formatting on the placeholder independently. enter image description here enter image description here