Formatting numbers in table

Info about design forms features
jkrsik
Posts: 30
Joined: 06 Oct 2014, 13:10

Formatting numbers in table

Postby jkrsik » 12 Nov 2015, 10:11

Numeric values in tables have to be formatted by method .ToString("")

url=https://msdn.microsoft.com/cs-cz/library/kfsatb94(v=vs.110).aspxToString method description/url

Common incorrect formatting is done by VAL or ROUND functions -> it is not correct way

bIncorrect example from Check Response calculation:/b
code
TExtremes[4][0].Value = TR("Reinforcement - tension");
TExtremes[4][1].Value = Val(Fibre↓st,max,print←, 0);
TExtremes[4][2].Value = Val(ε↓st,max←*1000, 2);
TExtremes[4][3].Value = Val(ε↓st,max,lim←*1000, 2);
TExtremes[4][4].Value = Val(σ↓st,max←/1000000, 2);
TExtremes[4][5].Value = Val(σ↓st,max,lim←/1000000, 2);
TExtremes[4][6].Value = Val(Check↓value,st←, 2).ToString("0.00");
/code
This incorrect formatting due in fact nothing, and results are always drawn in default formatting -three valid number

bCorrect formatting:/b
code
TExtremes[4][0].Value = TR("Reinforcement - tension");
TExtremes[4][1].Value = Fibre↓st,max,print←.ToString("0");
TExtremes[4][2].Value = (ε↓st,max←*1000).ToString("0.00");
TExtremes[4][3].Value = (ε↓st,max,lim←*1000).ToString("0.00");
TExtremes[4][4].Value = (σ↓st,max←/1000000).ToString("0");
TExtremes[4][5].Value = (σ↓st,max,lim←/1000000).ToString("0");
TExtremes[4][6].Value = (Check↓value,st←).ToString("0.00");
/code
this is correct formatting - deflections (Epsilon) on 2 decimals, stresses (Sigma) on 0 decimal, check value on 2 decimals

Another examples of formatting are in attachment
Attachments
ToString.cls
(29.61 KiB) Downloaded 457 times

Return to “Design forms features”

Who is online

Users browsing this forum: No registered users and 2 guests