Script to dynamically change the currency symbol.
I'm trying to write a script that would dynamically change the currency symbol based on the value of a Document Property. Please note that I'm trying to do an exchange rate conversion, that's already been done in the DB; one column in USD amounts (USD_AMT), another in local currency amounts (LOCAL_AMT) and a column to identify the currency type of LOCAL_AMT called LOCAL_CURR.
I've researched this online and have managed to piece together the following:
curr = Document.Properties["DropDownCurrency"] from System import Globalization from Spotfire.Dxp.Application.Visuals import CrossTablePlot from Spotfire.Dxp.Application.Visuals import CategoryKey from Spotfire.Dxp.Data import * from Spotfire.Dxp.Data.Formatters import * tbl = ReportToPlot.As[CrossTablePlot]() gbp = Globalization.CultureInfo("en-GB") usd = Globalization.CultureInfo("en-US") if curr == "GBP": lsf = DataType.Real.CreateCultureSpecificFormatter(gbp) lsf.Category = NumberFormatCategory.Currency lsf.DecimalDigits = 0 elif curr == "USD": lsf = DataType.Real.CreateCultureSpecificFormatter(usd) lsf.Category = NumberFormatCategory.Currency lsf.DecimalDigits = 0; from Spotfire.Dxp.Application.Visuals import CrossTablePlot tbl.MeasureAxis = CategoryKey('Variance') #Properties.Formatter = lsf
As you see it's not complete; I'm not proficient in IronPython. I think I'm on the right track but I'm not sure. I'd really appreciate some assistance completing this script. Thank you in advance.