[SSRS] Format Number culture / region specific with text

When it comes to SSRS Report Design combined with Dynamics AX 2012, it is very common to fall back to .NET functions to archieve certain goals.

When having a normal data field in a tablix element which displays a number value, you can set the format on the textbox itself via the Number property:

SSRS textbox property number format

Note the help text at the bottom that indicates the report will take care of the region specific format for you.

But what if you want to combine text and a formatted number within a single textbox?

For example, you want to combine a label text with a numeric value from a datasource field.
Suggestion would be the following expression:

=Labels!@SOH5676 & " " & Fields!CalculationAmount.Value

Or this one:

=Labels!@SOH5676 & " " & Format(Fields!CalculationAmount.Value, "N2")

But both of them won't take care of regional settings!

I found the the most reliable way for me is to use the C# method Microsoft.Dynamics.Framework.Reports.BuiltInMethods.ToDisplayStringAmount:

=Labels!@SOH5676 & " " & Microsoft.Dynamics.Framework.Reports.BuiltInMethods.ToDisplayStringAmount(Parameters!AX_RenderingCulture.Value, Fields!CalculationAmount.Value, true)


Software Engineer / Application Developer

Subscribe to robsCode

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!