0

I am working on a issue related with hard code value for the format property in some reports. No I am trying create custom format according to the culture code of my customers. The problem with my code is what my new format (for es-CL and en-US cultures) are not working, wich should be the correct mask if for en-US the thousan separator is , and . for es-Cl? Thank you

Public Shared Function GetTextMortNumberFormat(culture) As String
Select Case culture 
    Case "nb-NO"
        Return "# ### ###;-# ### ###;''"
    Case "es-CL"
        Return "#.###.###;-#.###.###;''"
    Case "en-US"
        Return "#,###,###;-#,###,###;''"
    Case Else           
        Return "# ### ###;-# ### ###;''"
End Select      
End Function
Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794
Rolando
  • 752
  • 1
  • 14
  • 41

2 Answers2

0

You should just use the user's internationalization settings. For the Language property of the report itself, use:

=User!Language

Now you can use the following formats which will use the user's regional language settings to format numbers appropriately:

  • N2 = number with 2 decimal places
  • N0 = number with no decimal places
  • P0 = percent with no decimal places
  • d = short date format

You can see other format strings here

Chris Latta
  • 20,316
  • 4
  • 62
  • 70
  • Hello Chris Latta, I could set the language property of the rdl file using something like language=Parameters!language.Value or language=User!Language , but what about when the value is 0 and i want show a space (' '). I could use a expression like that may be.. =IIF(Code.IsZeroOrEmpty(Fields!MyField.Value)," ",Fields!MyFields.Value).. – Rolando Feb 29 '12 at 03:09
0

The comma will always try to substitute in the locale's thousands separator, and the period will anchor to the decimal position and substitute the locale's decimal separator. http://msdn.microsoft.com/en-us/library/0c899ak8.aspx

You can hard code in a locale by using just a little .net: format number in ssrs report

Community
  • 1
  • 1
Jamie F
  • 23,189
  • 5
  • 61
  • 77