How can I prevent rounding in an rdlc report?

In RDLC, one of the columns is 2.099. I want it to be 2.09. I already used the Format and FormatNumber function in the RDLC expression. But the result is 2.10. But I need 2.09. How??

I tried as follows:

= FormatNumber (Sum (Switch!) IsConsiderGPA.Value) = True, (Fields! Credit.Value) * (Fields! GPA.Value)) / Sum (Switch (Fields! IsConsiderGPA.Value = True, (Credit.Value fields !))), 2)

= Format (Sum (Switch ((Fields! IsConsiderGPA.Value) = True, (Fields! Credit.value) * (Fields! GPA.Value))) / Sum (Switch (Fields! IsConsiderGPA.Value = True, (Credit Fields .Value!))), "N")

= Format (Sum (Switch ((Fields! IsConsiderGPA.Value) = True, (Fields! Credit.value) * (Fields! GPA.Value))) / Sum (Switch (Fields! IsConsiderGPA.Value = True, (Credit Fields .Value!))), "D")

And also changed the Number type in the text box properties. But failed .....

+1
source share
2 answers

Use Math.Trucate in your expression, for example:

= Math.Truncate (Sum (Switch!) IsConsiderGPA.Value) = True, (Fields! Credit.Value) * (Fields! GPA.Value))) / Sum (Switch (Fields! IsConsiderGPA.Value = True, (Fields! Credit.Value)))) * 100) / 100

You can then format the number as shown in the Number tab vertically in the text box properties.

+2
source

" " :

    Public Function WithoutRound(vl As String)

        Dim temp As String

        temp = FormatNumber(vl, 4)

        temp = Left(temp, Len(temp) - 2)

        Return temp.ToUpper()

    End Function

,

= Code.WithoutRound(Fields! RunningBalance.Value)

0

Source: https://habr.com/ru/post/1731663/


All Articles