Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,296,276
Community Members
 
Community Events
165
Community Groups

Confiforms, Decimal Separator of Numerics: How to convert number from ‘comma’ to ‘dot’ notation?

Edited

Goal

Formatting a number that a user inputs from comma format to dot format.

E.g.: Convert 125,55 to 125.55

 

What does work

The virtual function 'formatNumberWithLocale(de)' works fine when formatting a numeric with a dot as decimal mark to a comma as decimal mark. E.g.: 1.5 -> 1,5 

So this works: [entry.InputField.formatNumberWithLocale(de)]

 

Problem

But the virtual function 'formatNumberWithLocale(en)' does not work when trying to format a comma as decimal separator to a dot notation. E.g.: 2,5 -> 2.5

This does not work: [entry.InputField.formatNumberWithLocale(en)]

   

Any help or hints are appreciated. Thank you in advance!

 

Storage Format

This example should illustrate my problem in 'Storage Format':

 


<p class="auto-cursor-target">
<br/>
</p>
<ac:structured-macro ac:macro-id="f0b25227-1287-41f8-94ff-8bdb34322412" ac:name="panel" ac:schema-version="1">
<ac:rich-text-body>
<p>
<strong>Question</strong>
</p>
<p>Why does the virtual function [entry.commaToDot.formatNumberWithLocale(en)] (located in: PlainView) not transform a comma decimal separator into a dot decimal separator?</p>
<p>E.g: Why is the input '1,5' not formatted into '1.5'</p>
<p>
<br/>
</p>
<p>Interesting:</p>
<p>The virtual function  [entry.dotToComma.formatNumberWithLocale(de)]  works: It transforms for example '4.5' into '4,5'.</p>
</ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
<br/>
</p>
<p class="auto-cursor-target">
<br/>
</p>
<ac:structured-macro ac:macro-id="d4690b47-b46b-4b3a-ac05-bbe207074fc8" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">form</ac:parameter>
<ac:rich-text-body>
<p class="auto-cursor-target">
<ac:structured-macro ac:macro-id="bf178309-5d77-4ccf-98b6-c8c7e6e44782" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">dotToComma</ac:parameter>
<ac:parameter ac:name="fieldLabel">dotToComma</ac:parameter>
<ac:parameter ac:name="fieldDescription">The virtual function 'formatNumberWithLocale(de) works for transofming the decimal seperator fro dot to comma. E.g.: 1.5 -&gt; 1,5</ac:parameter>
<ac:parameter ac:name="type">number</ac:parameter>
</ac:structured-macro>
</p>
<p class="auto-cursor-target">
<ac:structured-macro ac:macro-id="9be7b85c-7f5d-4875-b5a9-602103528fa4" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">commaToDot</ac:parameter>
<ac:parameter ac:name="fieldLabel">commaToDot</ac:parameter>
<ac:parameter ac:name="fieldDescription">But the virtual function 'formatNumberWithLocale(en)' does not work to change the decimal seperator from comma to dot. E.g.: 2,5 -&gt; 2.5</ac:parameter>
<ac:parameter ac:name="type">number</ac:parameter>
</ac:structured-macro>
</p>
<ac:structured-macro ac:macro-id="f74e24e8-71f7-4521-b451-dc270f07d974" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:parameter ac:name="formName">form</ac:parameter>
<ac:parameter ac:name="type">Embedded</ac:parameter>
<ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
<br/>
</p>
<ac:structured-macro ac:macro-id="26868c63-22fb-401e-b7ec-2167720e95f5" ac:name="confiform-plain" ac:schema-version="1">
<ac:parameter ac:name="formName">form</ac:parameter>
<ac:plain-text-body><![CDATA[[entry.commaToDot.formatNumberWithLocale(en)] | [entry.dotToComma.formatNumberWithLocale(de)] |
]]></ac:plain-text-body>
</ac:structured-macro>
<p>
<br/>
</p>
<p>
<br/>
</p>
<p>
<br/>
</p>
<p>
<br/>
</p>

 

1 answer

Any reason for this? Is not working for me as well!

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

Confluence: Where work and wellness meet

Feeling overwhelmed by the demands of work and life? With a 25% increase in the prevalence of anxiety and depression worldwide during the pandemic, for most of us, it’s a resounding yes . 🙋‍♀️ ...

1,017 views 17 27
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you