It's all about the answers!

Ask a question

EWM: How do I display a decimal field with a fixed number of decimal points?

Heather Linsk (1422252) | asked Mar 16 '21, 10:43 a.m.

I have several decimal attributes that are storing dollar values.  I want to be able to display those fields in the Work Item presentation layer as a fixed 2 point decimal.

For example:  

Current behavior:  value = 1.00  displayed as:  1
Desired:  value = 1.00  displayed as: 1.00


One answer

permanent link
Ralph Schoon (63.2k33646) | answered Mar 17 '21, 4:25 a.m.

 I gave it a shot. You have only one presentation kind, there are no obvious properties or flags that you can choose to change the behavior. So, I do not see a way to change the behavior to what you want.

It would be nice if there was some kind of format extension or scripting that would be possible. Feel free to write an enhancement request.

I have experimented with different ways of solving such a problem with out of the box capabilities. My approaches were to use string based attributes in several ways:
1. As attribute to store the data - this requires custom validators to make sure users do not type invalid data.
2. A calculated value as representation in a string attribute. I do not like adding artificial attributes that are potentially written too often, but it is a valid approach in some cases. This gets around typing invalid values to some extend, but shows you a different formatting.

Your answer

Register or to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.