开发者

SSRS Report Decimals

开发者 https://www.devze.com 2023-01-08 07:27 出处:网络
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.

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 displa开发者_JAVA百科y 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.


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,".

0

精彩评论

暂无评论...
验证码 换一张
取 消