[ic] converting to 2 decimal places problem

Jerry interchange-users@icdevgroup.org
Mon Nov 25 08:08:01 2002


> -----Original Message-----
> From: interchange-users-admin@icdevgroup.org
> [mailto:interchange-users-admin@icdevgroup.org]On Behalf Of Dion Jones
> Sent: Monday, November 25, 2002 6:57 AM
> To: 'interchange-users@icdevgroup.org'
> Subject: [ic] converting to 2 decimal places problem
> 
> 
> I currently have this code:
> 
> 	[calc][item-field height]/2.54[/calc] inches
> 
> to convert my Cm into inches and output it on a page but this produces a
> crazy amount of decimal places.  how can I get it down to just 2dp?
> 
> cheers

Can't remember honestly if there is built in way to set decemil place
formating, but a adding a little perl should do nicely.

[calc interpolate=1]
$height = (int([item-field height]/2.54 * 100))/100;
return $height;
[calc]

Jerry Uphoff