如何防止在 rdlc 报告中四舍五入? [英] How can I prevent rounding off in rdlc report?
问题描述
在 RDLC 中,列输出之一是 2.099.我希望它是 2.09.我已经在 RDLC 表达式中使用了 Format 和 FormatNumber 函数.但是输出是2.10.但我需要 2.09.怎么样??
In RDLC, One of the column output is 2.099. I want it as 2.09. I've already used Format and FormatNumber Function in RDLC expression. But the output is 2.10. But I need 2.09. How??
我尝试过以下方法:
=FormatNumber (Sum(Switch((Fields!IsConsiderGPA.Value) = True , (Fields!Credit.Value) * (Fields!GPA.Value) ))/Sum(Switch(Fields!IsConsiderGPA.Value = True ,(Fields!Credit.Value))),2)
=FormatNumber (Sum(Switch((Fields!IsConsiderGPA.Value) = True , (Fields!Credit.Value) * (Fields!GPA.Value) )) / Sum(Switch(Fields!IsConsiderGPA.Value = True , (Fields!Credit.Value))),2)
=Format (Sum(Switch((Fields!IsConsiderGPA.Value) = True , (Fields!Credit.Value) * (Fields!GPA.Value) ))/Sum(Switch(Fields!IsConsiderGPA.Value = True ,(Fields!Credit.Value))),"N")
=Format (Sum(Switch((Fields!IsConsiderGPA.Value) = True , (Fields!Credit.Value) * (Fields!GPA.Value) )) / Sum(Switch(Fields!IsConsiderGPA.Value = True , (Fields!Credit.Value))),"N")
=Format (Sum(Switch((Fields!IsConsiderGPA.Value) = True , (Fields!Credit.Value) * (Fields!GPA.Value) ))/Sum(Switch(Fields!IsConsiderGPA.Value = True ,(Fields!Credit.Value))),"D")
=Format (Sum(Switch((Fields!IsConsiderGPA.Value) = True , (Fields!Credit.Value) * (Fields!GPA.Value) )) / Sum(Switch(Fields!IsConsiderGPA.Value = True , (Fields!Credit.Value))),"D")
并且还更改了文本框属性中的数字类型.但是失败了......
And also changed the Number type in Text box properties. But failed.....
推荐答案
在表达式中使用 Math.Trucate,例如:
Use Math.Trucate in your expression, ex:
=Math.Truncate(Sum(Switch((Fields!IsConsiderGPA.Value) = True , (Fields!Credit.Value) * (Fields!GPA.Value) ))/Sum(Switch(Fields!IsConsiderGPA.Value) =True , (Fields!Credit.Value))))*100)/100
=Math.Truncate(Sum(Switch((Fields!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 you with in the "Number" vertical tab in the text box properties.
这篇关于如何防止在 rdlc 报告中四舍五入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!