When setting up systems in an industrial environment, the problem of displaying a number as a currency format arises time and again.
User story
It should be possible to define a number attribute in which you can specify a currency symbol of your choice in the format. In addition to the symbol, it should also be possible to specify the number of decimal places to be displayed (e.g. 3 decimal places for gold prices or other precious metals).
It would be good if I had a combination of number format and currency symbol. So if I could provide a field with the format "Currency Euro 2 digits". In the input it would then be possible to enter the value "15", which would then be displayed in the table as "15.00 €". If I want to edit the cell and click on it, I can change the amount. If I want to change the € sign, I can delete or overwrite it. If the field loses focus, the euro sign appears again (if deleted) or an error message appears (wrong data type if overwritten). I think 2 predefined data types ("€ 2-digit", "$ 2-digit") and the possibility for the admin to define further types are sufficient.
Code migration
If formats have already been defined globally in the application via the com.top_logic.basic.format.configured.FormatterService service, the configuration schema must be adapted.
Before
<config service-class="com.top_logic.basic.format.configured.FormatterService"> <instance> <formats> <decimal id="double" normalize="true" pattern="#,##0.00" result-type="double" /> <formats> <instance> </config>
After
<config service-class="com.top_logic.basic.format.configured.FormatterService"> <instance> <formats> <format id="double"> <decimal normalize="true" pattern="#,##0.00" result-type="double" /> </format> <formats> <instance> </config>
Test
- New attributes cost and weight in DemoTypes:A.