Dynamically Format Currency Values Based on Language in Bold Reports
Overview
In Bold Reports, currency values can be formatted dynamically based on the selected culture by using expressions and report parameters. This approach enables reports to display appropriate currency symbols and formats, such as the dollar ($) symbol for en-US and the euro (€) symbol for fr-FR. This improves localization and usability in multilingual reporting environments.
Step-by-Step Instructions
Step 1: Create a Language Parameter
- In the Data configuration pane of the Bold Reports Web Designer, click the Parameters icon and select New Parameter.
- Set the Name to
Languageand the Prompt property toSelect Language. - In the Available Values section, select Specify values.
- Click Add and enter the culture values that the report should support.
- Click OK to save the parameter.
Step 2: Apply the Dynamic Format Expression
-
Select the Textbox or Table Cell that contains the numeric value to be formatted as currency.
-
Open the Properties pane.
-
Locate the Format property.
-
Click the expression (fx) icon next to it and select Expression.
-
In the Expression Editor, enter the
Switchexpression shown below.
Use the following expression to dynamically format currency values based on the selected Language parameter:
=Switch(
Parameters!Language.Value = "en-US", "$#,##0.00;($#,##0.00)",
Parameters!Language.Value = "fr-FR", "€#,##0.00;(€#,##0.00)",
True, "#,##0.00;(#,##0.00)"
)
Step 3: Save and Preview the Report
- Click Preview in the top toolbar.
- Select English (US) from the
Languageparameter dropdown and click View Report. The values are displayed with the $ currency symbol.
- Change the parameter to French (France) and click View Report. The values are displayed with the € currency symbol.
Sample Report
Download the sample report from here