SSRS 报告小数
我已经对其进行了一些搜索,但无法使其正常工作。
我希望报告显示与字段一样多的小数字符,就这么简单。
示例:
- 值 = 169.99 |输出 = 169.99
- 值 = 169.9999 |输出 = 169.9999
如果我没有将 Format 属性设置为任何内容,它会对齐字段,有时它返回 2 位小数,有时返回 4 位小数,即使我只有 2 位小数。
那么如何格式化它以显示与值一样多的小数字符呢?
PS:我使用的是巴西葡萄牙语,所以它返回“169,9900”,但我认为这与它没有任何关系,因为美式英语也做了同样的事情。
PS 2:字段数据类型为 MONEY。
I have searched a bit upon it but can't get it to work properly.
I want the report to display as many decimal characters as the field has, simple as that.
Example:
- Value = 169.99 | Ouput = 169.99
- Value = 169.9999 | Output = 169.9999
If I don't set the Format property to anything, it kinda aligns the fields, sometimes it returns 2 decimals, sometimes 4 decimals, even though I only have 2 decimals.
So how do I format it to display exactly as much decimal characters as the value has?
PS: I'm using Brazilian Portuguese language, so it's returning "169,9900" but I don't think it has anything to do with it since American English did the same.
PS 2: Fields datatype is MONEY.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决方案:
我编写了一个表达式来检查“,”信号后面是否有零。
无法让它与配置一起使用,或者通过 Format 属性,必须编写一些逻辑作为表达式。
逻辑:
它基本上用空格替换所有零,然后修剪字符串的末尾,删除末尾无用的零,然后用零替换空格。当然,事情没那么简单,但我涵盖了所有其他可能发生的情况,例如,如果字符串在“,”信号后仅以零结尾,则它将是“200,”。
Solution:
I wrote an expression to check for zeros after the "," signal.
Couldn't get it to work with a configuration or though the Format property, had to write some logic as an expression.
The logic:
It basically replaces all the zeros with a space, then trims the end of the string, removing useless zeros at the end, and replaces spaces back with zeros. Of course it isn't that simple, but I covered all the other cases that could happen, like for example, if the string finished with only zeros after the "," signal, it would be "200,".