Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Format for 8 decimal
Adiel
<p>Hi All,</p>
<p> </p>
<p>I have requirement to define up to 8 decimal and it should be dynamic.</p>
<p>My code is:</p>
<p>a = 189,214,958.4</p>
<p>Format(a,"##,###,##0.00######")</p>
<p>Result :<span style="font-size:14px;">189,214,958.40000001</span></p>
<p><span style="font-size:14px;">Expected Result: </span><span style="font-size:14px;">189,214,958.4</span></p>
<p> </p>
<p><span style="font-size:14px;">Any Idea why there is additional .0</span><span style="font-size:14px;">0000001 in my value?</span></p>
<p> </p>
<p><span style="font-size:14px;">Any other way to format my data?</span></p>
<p> </p>
<p> </p>
<p><span style="font-size:14px;">Cheers,</span></p>
<p><span style="font-size:14px;">Fera</span></p>
Find more posts tagged with
Comments
pricher
<p>Hi,</p>
<p> </p>
<p>There are a few issues in the code snippet you sent. First, the number assignment to variable "a" should not have thousand separators.</p>
<p>Second, the function Format should give you a run time error. Third, the formatting mask you use will force 2 decimals.</p>
<p> </p>
<p>Try the following code in a Dynamic Text component:</p>
<p> </p>
<p><span style="font-family:'courier new', courier, monospace;">a = 189214958.4<br>
Formatter.format(a,"#,###,##0.0######")</span></p>
<p> </p>
<p>This should give you the expected result.</p>
<p> </p>
<p>Hope this helps,</p>
<p> </p>
<p>P.</p>
Adiel
<blockquote class="ipsBlockquote" data-author="pricher" data-cid="130448" data-time="1409214649">
<div>
<p>Hi,</p>
<p> </p>
<p>There are a few issues in the code snippet you sent. First, the number assignment to variable "a" should not have thousand separators.</p>
<p>Second, the function Format should give you a run time error. Third, the formatting mask you use will force 2 decimals.</p>
<p> </p>
<p>Try the following code in a Dynamic Text component:</p>
<p> </p>
<p><span style="font-family:'courier new', courier, monospace;">a = 189214958.4<br>
Formatter.format(a,"#,###,##0.0######")</span></p>
<p> </p>
<p>This should give you the expected result.</p>
<p> </p>
<p>Hope this helps,</p>
<p> </p>
<p>P.</p>
</div>
</blockquote>
<p>Hi P,</p>
<p> </p>
<p> </p>
<p>Thanks for your quick response. a value is actually one of my data. Value of a maximum 16 digit. It could be any length.</p>
<p>e.g:</p>
<p>a = 99999999.12334</p>
<p>expected: 99,999,999.12345678</p>
<p><span>a = 12334.123</span></p>
<p><span>expected: 12,334.123</span></p>
<p> </p>
<p>I am not sure how to make my format become more flexible. </p>
<p> </p>
<p>Cheers,</p>
<p>Fera</p>
pricher
<p>Hi,</p>
<p> </p>
<p>From what you're saying, you should be able to use Number Formatting from the property editor of your data item.</p>
<p> </p>
<p>The attached report design shows a few examples of data unformatted, formatted with 8 decimals, and formatted with 4 decimals.</p>
<p> </p>
<p>Hope this helps,</p>
<p> </p>
<p>P.</p>
Adiel
<blockquote class="ipsBlockquote" data-author="pricher" data-cid="130451" data-time="1409220452">
<div>
<p>Hi,</p>
<p> </p>
<p>From what you're saying, you should be able to use Number Formatting from the property editor of your data item.</p>
<p> </p>
<p>The attached report design shows a few examples of data unformatted, formatted with 8 decimals, and formatted with 4 decimals.</p>
<p> </p>
<p>Hope this helps,</p>
<p> </p>
<p>P.</p>
</div>
</blockquote>
<p>Hi P,</p>
<p> </p>
<p>Currently I am using e report designer. Do you have .rod instead?</p>
<p>Sorry I am quite new with actuate.</p>
<p> </p>
<p>Cheers,</p>
<p>Fera</p>
pricher
<p>Hi Fera,</p>
<p> </p>
<p>This is a BIRT forum. I would suggest you contact Actuate Support for your question.</p>
<p> </p>
<p>Regards,</p>
<p> </p>
<p>P.</p>
Adiel
<blockquote class="ipsBlockquote" data-author="pricher" data-cid="130471" data-time="1409295513">
<div>
<p>Hi Fera,</p>
<p> </p>
<p>This is a BIRT forum. I would suggest you contact Actuate Support for your question.</p>
<p> </p>
<p>Regards,</p>
<p> </p>
<p>P.</p>
</div>
</blockquote>
<p>Hi P,</p>
<p> </p>
<p>Noted. Thanks for your time.</p>
<p> </p>
<p>Cheers,</p>
<p>Fera</p>