Where I started
I’ve got two numbers having 4 decimal places. Let’s call them A and B.
What I wanted
I wanted to display [A] divided by [B] with maximum precision. Or at least higher precision than 4.
What I got
However, if the result is not rounded to exactly 4 decimal places, it is never shown. To find this out cost me an hour of my lifetime.
Question
This seems to be an oddly specific limitation. Is there a way around it?
This example will not work. It only works if rounded to 4 places.
This is how the original that I wanted to recreate looks like:
Hi @juergen-smooth-ice
First and foremost, the behavior that you are describing is not that standard behavior of Computed Number Fields.
Normally, you see an error in the Computation Rule Editor if the "maximum number of fractional digits of the left hand side (x) and of the right-hand side (y) are different [MVK_INVALID_COMPARE_DEC_PLACES]. This is explained in the Kernel Language documentation.
In your case, your computed Field seems to have a maximum of 4 decimal places allowed but your computation rounds to 8 decimal places (x=4, y=8).
You have suppressed the standard error by clicking “Allow differeing decimal places” in the Computation Rule Editor. This setting is described in the Document Modeling documentation and states:
“Checking this allows the comparison of numbers with an unequal number of decimal places (fractional digits) within the precondition and calculation statements or returning as computation result the value of a number field with fewer decimal places than the computed field specifies.”
The key words here are fewer decimal places.
This setting should only be used if the number of decimal places in your result is less than the number of decimal places specified in your computed field. For example:
Computed Field: Min Dec Places = 8, Max Dec Places = 8
Computation: 10 * 10
Normally you would have to model
RoundAccounting(10*10,8)
to increase the number of decimal places in your result to match the computed Field. The setting that you made allows this.
However, “Allow differeing decimal places” does not allow us to round, truncate or overlook a result with too many decimal places. There is no modeling solution for your requirement to carry full precision numbers through your applicaiton. This would be a new requirement.
Thinking about your requirement differently, can you remodel your workspace so that you always base your computations on numbers with full precision?
I believe that your requirement comes from wanting to:
- compute an intermediate result
- display this result with reduced precision
- use this result with full precision
Can you simply write this intermediate computation into the final computation where you need full precision? Like this
FullPrecision_DM.json (9.6 KB)
2024.06-ext4 model
Withdrawn
User error. Turned out that I didn’t increase the precision on the computed field. When I set that to a number higher than 4 and then round into it, it works, even without “Allow differing decimal places”.