Limit Decimal Places from Length Task
I'm receiving an number from a length task that has 14x decimal places.
Is there any way to limit this output to just 2x decimal places?
Walter
-
Hi Walter
you could use String.Format in an Alert Activity http://msdn.microsoft.com/en-us/library/system.string.format(v=vs.110).aspx
ie String.Format("{0:#.##}",double1)
where double1 is the number variable your are having trouble with
or Math.Round Method (Decimal, Int32) http://msdn.microsoft.com/en-us/library/zy06z30k(v=vs.110).aspx
depending whether you want a string or a number
Regards
Ralph
0 -
Thanks very much Ralph
You're always a great help.
Walter
0 -
Ralph,
When I used your suggested string.Format("{0:#.##}",listofLengths) for my varaible called "listofLengths" which is a List<Double>,
/customer/servlet/servlet.FileDownload?file=00P6000000em16EEAQ
the result above is what I get. If I just use the listOfLengths().ToString I get values such as
35.381011345555
Not having any luck with formatting this List<Double> variable
Walter
0 -
Got It......
listOfLengths(0).ToString("###.###") + " metres"
Walter
0 -
Hi Walter
top marks for persistence ;-)
regards
Ralph
0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
5 Kommentare