How to Sum Reportitems!textbox.values

  • Hi All,

    Can someone assist me as how can I sum reportitems values.

    my expression is below, but it display a binary code like 1.001.001.00

    =reportitems!YTDKRA_Closed_WITH_SLA.Value+

    reportitems!YTDKRA_Closed_ofAssignned.Value+

    reportitems!YTDKRA_Perc_Queries_Red.Value+

    reportitems!YTDKRA_Perc_Queries_Amber.Value+

    reportitems!YTDKRA_Per_Internal_Quality.Value+

    reportitems!YTDKRA_Per_External_Quality.Value

  • What are the values in the individual fields?

    It looks like it's concatenating three string values of "1.00", "1.00" and "1.00"

    You may need to convert to a numeric type before doing the addition using CDbl or CDec like this:

    CDbl(reportitems!TextBox1.Value) + CDbl(reportitems!TextBox2.Value) + ...

    See here for details of the VB conversion functions.

  • Or you could add the values by referencing the original columns from the report dataset, or do the calculation in your query or stored proc. Either of which is probably more correct as the fields in the report itself may be formatted with for example a fixed number of decimal places which in certain cases could give you an incorrect sum.

  • Thank, It worked perfectly

    All the best

  • Good, which solution did you use? Just for the benfit of others.

  • I have learned to convert the field values data types. I was wrong when I thought you can simple convert it from the property window format portion.

  • Removed: my assumption was incorrect! Talking **** again 😀

    I had assumed that formatting a field would affect any arithmetic done on that field as a result of the formatting. After trying it out I found that this is not the case, which makes sense after thinking about it some more.

    Serves me right for jumping in before I'd had enough coffee

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply