Format numbers with two decimals.

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Format numbers with two decimals.

Post by Me_again » Wed Aug 02, 2006 11:45 pm

How do I format numbers to always have two decimals e.g. 0 as 0.00, 1 as 1.00, 1.1 as 1.10 ?

The numbers are mm read from a file, converted to inches and rounded to max two places with VB. The result is written to a file and needs to always show 2 dp's.

Let>rain=param_8/25.4
VBEval>Round(%rain%,2),rain
Let>in= in.
ConCat>rain,in

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Aug 03, 2006 1:30 am

VBEval>FormatNumber(%rain%,2),rain
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Thu Aug 03, 2006 4:00 am

Perfect, thanks :D

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts