Custom datatype for percent

Hello. I would like the user to enter/see 45.67% (or maybe just 45.67) but have the system store 0.4567 in the database. Would you recommend using a custom datatype for this? Or is there an better/easier way?

I always considered storing percentages as decimals as standard practice. I was surprised I could not find a Vaadin component to handle it…

Hi
I think the upcoming version 6.7 will have annotation to format numbers in different ways instead of implementing custom datatype. Have a look at this thread: https://www.cuba-platform.com/discuss/t/numeric-field-without-comma-formatting

Hi,

as mortoza said the Number datatype customizable by an annotation on entity attribute feature (that will be released in 6.7 version) is the best way to solve your problem.

Best regards,
Daniil.

Thank you for the heads up. I’m glad I asked.

:ticket: See the following issue in our bug tracker:

https://youtrack.cuba-platform.com/issue/PL-7273