from Spotfire.Dxp.Data import DataType
from Spotfire.Dxp.Data.Formatters import NumberFormatCategory
formatter=DataType.Real.CreateLocalizedFormatter()
formatter.Category=NumberFormatCategory.Number
formatter.DecimalDigits=02
#table is a DataTable script parameter
table.Columns["temperaturemin"].Properties.Formatter=formatter
1 comment:
Some additional options...
Apply 'standard' short formatting (with thousands separator)
formatter.ShortFormattingEnabled =1
formatter.GroupSeparatorEnabled =1
Apply short formatting using custom symbols:
Symbols=List[ShortFormattingSymbol]()
Symbols.Add(ShortFormattingSymbol("k", 3));
Symbols.Add(ShortFormattingSymbol("M", 6));
Symbols.Add(ShortFormattingSymbol("B", 9));
Symbols.Add(ShortFormattingSymbol("T", 12));
xyz=ShortFormattingSymbolScheme("XYZ", Symbols);
formatter.ShortFormattingSymbolScheme = xyz;
Apply short format using a 'custom' format string:
formatter.FormatString = "$#,##0,,.#M"
For more info on custom string formats:
https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings
-Jolene Robertson
Post a Comment