SSRS 报告小数

发布于 2024-09-11 00:54:21 字数 364 浏览 4 评论 0原文

我已经对其进行了一些搜索,但无法使其正常工作。

我希望报告显示与字段一样多的小数字符,就这么简单。

示例:

  • 值 = 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蓝咒 2024-09-18 00:54:21

解决方案:

我编写了一个表达式来检查“,”信号后面是否有零。
无法让它与配置一起使用,或者通过 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,".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文