API: Num
Filename:
fwpNum_dec1.ctag
Released With:
5.0.0
Current Version:
1.0.1
Status: Active
Min Lasso Tested: 8.1.0
Max Lasso Tested: 8.5.3
Related:
Still don't get it?
Check out the talk list archives, or join and ask your questions.
Documentation Error or Request?
Email documentation corrections or comments
Formats a specified number into a decimal format with single digit precision.
Uses the character specified by $fw_numGroupChar to separate thousands, etc. Uses the character specified by $fw_numDecimalChar to separate whole and fractional values. Therefore, it can display numbers in 123,345,678.9 and 123.345.678,9 formats.
[fwpNum_dec1: integer|decimal]
[fwpNum_dec1: 3.1415] results in 3.1
[fwpNum_dec1: 3] results in 3.0
[fwpNum_dec1: (field:'studentGPA')]
<?lassoscript
//............................................................................
//
// pageblocks: (c) 2002-2007 http://www.pageblocks.org/
//
//............................................................................
/*
{fileName= fwpNum_dec1.ctag }
{rsrcType= tag }
{rsrcName= fwpNum_dec1 }
{rsrcHTTP= www.pageblocks.org/refc/fwpNum_dec1 }
{lassoVrsnMin= 8.1.0 }
{lassoVrsnMax= 8.5.3 }
{author= Greg Willits }
{authorEmail= subscribe to pbTalk at www.pageblocks.org/talk/ }
{authorHTTP= www.pageblocks.org }
{desc= formats a number with one decimal place and thousands separators }
{maintvsrn= 1.1 }
{maintrelease= 5.2.5 }
{maintdate= 2006-07-23 }
{maintauthor= Greg Willits }
{maintnotes= added comma stripping so strings like 1,000 would
convert properly }
{maintvsrn= 1.0.1 }
{maintrelease= 5.1.0 }
{maintdate= 2006-08-07 }
{maintauthor= Greg Willits }
{maintnotes= updated to use $fw_client }
{maintvsrn= 1.0 }
{maintrelease= 5.0.0 }
{maintdate= 2006-01-16 }
{maintauthor= Greg Willits }
{maintnotes= initial release }
*/
//............................................................................
define_tag:'fwpNum_dec1', -priority='replace';
local:'fw_num' = string:(params->get:1);
#fw_num->(replace:',','');
#fw_num = decimal:#fw_num;
#fw_num->(setformat:
-precision = 1,
-groupchar = $fw_client->thousandsChar,
-decimalchar = $fw_client->decimalChar);
return: #fw_num;
/define_tag;
?>
© 2002-2012, pageblocks.org