Nemanja Todorovic
Nemanja Todorovic

Reputation: 2830

SSRS Number Formating through Parameter

I am using SSRS reports and on many of them I have some numbers displayed, often larger than 1000 and often with decimals. I can easily format those numbers to represent as 1.000,00 for example, but my problem is that some of my users want to see thousands separator as comma and some as dot (and vice versa for decimal separator). I could probably pass custom number format as parameter to the report but then I would have to apply it to each number on my report. Is there any easier/better solution to this?

To summarize, I want for example that some of my users see number 1000 as 1.000,00 and others as 1,000.00 based on parameter that I will pass to the report (let’s say @NumberFormatingStyle), that is somehow applied to all numbers on the report without explicitly setting it to each number field.

Upvotes: 0

Views: 573

Answers (2)

Nemanja Todorovic
Nemanja Todorovic

Reputation: 2830

I have found simple solution to this. I set Language of the report to my @Culture parameter (which has values such as "en-US" and such, passed to the report). Afterwards, I just had to set "Use regional formating" to my number placeholders and it would format numbers in a way that I want (which is regulated through passed @Culture parameter, which I use anyway). This way I don't have to format each number manually.

Upvotes: 0

Aldrin
Aldrin

Reputation: 766

You should apply it to Format property of each textbox that you want the format to be dynamic.

First you need to do is create the Parameter @NumberFormatingStyle.

Add value manually.

Value = 1, Label = Comma

Value = 2, Label = Dot/Point

Then put an expression that is something like this to the Format property.(Just change the value between the quotes, use your appropriate format to be applied)

=SWITCH(Parameters!NumberFormattingStyle.Value = 1,"#,0.00;(#,0.00)","#.0.00;(#.0.00)")

Upvotes: 1

Related Questions