template::util::currency::set_property (public)
template::util::currency::set_property what currency_list value
Defined in packages/acs-templating/tcl/currency-procs.tcl
Set a currency value to a set value, with that value being of "what" form. Currently the only "what" supported is sql_number, it being assumed (somewhat reasonably) that SQL's NUMERIC datatype will be used to store currency data in the database, regardless of locale.
- Parameters:
- what (required)
- What kind of value is being passed in (sql_number is the only format supported)
- currency_list (required)
- A currency data type value
- value (required)
- The value to set currency_list to
- Returns:
- currency_list set to value
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: # Erase leading zeros from the value, but make sure that 00 # is not completely erased set value [util::trim_leading_zeros $value] set format [lindex $currency_list 5] switch -- $what { sql_number { if { $value eq ""} { return "" } foreach {whole_part fractional_part} [split $value "."] { # Make sure we have at least one leading digit, i.e. zero set whole_part "[string range "0" [string length $whole_part] end]$whole_part" # Chop off trailing digits beyond those called for by the given format set fractional_part "[string range $fractional_part 0 [lindex $format 3]-1]" } set new_value [lreplace $currency_list 1 1 $whole_part] return [lreplace $new_value 3 3 $fractional_part] } default { error "util::currency::property: unknown property: '$what'." } }XQL Not present: Generic, PostgreSQL, Oracle