The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
Rounding and display in 2 decimal place
mengkoon007
Member Posts: 30 Contributor II
Hi,
I am calculating some numeric number and noticed that the display is either integer or 3 decimal.
Can someone kindly advise which operator can I use for below?
1) Round to 2 decimal place and display as 2 decimal place
- I tried using "Generate Attribute" by indicating round(a/b,2). Eg. result is 2.035 and rounding become 2.040, this steps round to 2 decimal but when display it still show 3 decimal
2) I need a column to display in percentage, then round and display as 2 decimal place. Eg. The value is 2.046789, in percentage is 204.6789%, the final display needs to be as 204.68%.
0
Answers
As you are looking at changing the way it displays I would recommend the Format Numbers operator. You can use this to format a number in a pattern of your choosing and display it as a nominal value.
For example 20.000203 can become 20.00% or various other combinations.
Hi,
Thanks for the advice.
I have tried using format number operator with format type as pattern.The pattern type indicate as 0.00
May I check
1) does it just display as 2 decimal or
2) it actually round to 2 decimal and then display as 2 decimal?
If it is point 1, the rounding is it needs to be done using the generate attribute operator first, then use format number operator to display in 2 decimal?
=======
Another question:
I need to add this percentage logo "%" to 1 of my calculated value, I have tried using the following method but the value is incorrect:
1) Generate Attribute = round (a/b*100,2) = eg. 150.460
2) Format number = pattern type = 0.00% = eg. 15046.00%
The result i need is 150.46%.
I tried a tedious method as below and seems to get the result, can anyone kindly advise if there is a correct way to do it? Thanks.
1) Generate Attribute = round (a/b*100,2) = eg. 150.460 (attribute name: r_ratio) => I am rounding to 2 decimal after multiply value *100%
2) Generate Attribute = r_ratio/100 => I am making the value to before multiple 100% and this value has already been rounded
3) Format number = pattern type = 0.00%, the value now show as 150.46%