2

I am using SSRS Report and I need to define a Custom Number Format for Tablix Textbox.

For example:

Convert 012123456 To 012-123456.

How can I do this by using custom number format or by using FORMAT

Please suggest me!

Thanks

Pedram
  • 6,256
  • 10
  • 65
  • 87

3 Answers3

2

Firstly, I have tried below as per this post, but no success.

=Format(Fields!Number.Value,"000-000000")
=Format(Fields!Number.Value,"###-#######")

Then I tried something like below and working fine now.

=Format(CDbl(Fields!Number.Value),"000-000000")

I can use this, =Format(CDbl(Fields!PA_File_Number.Value),"###-######") but output would be 12-123456 and I want 012-123456.

Here, CDbl() is required as my Number column datatype is varchar()

Community
  • 1
  • 1
Pedram
  • 6,256
  • 10
  • 65
  • 87
0

Maybe you need change format style

"###-######"

to

"0##-######"

"(0). Digit placeholder. Displays a digit or a zero. If the expression has a digit in the position where the zero appears in the format string, display it; otherwise, displays a zero in that position." Additional information about various placeholders you can find on then MSDN page (https://msdn.microsoft.com/en-us/library/4fb56f4y(v=vs.90).aspx)

fabulaspb
  • 1,238
  • 8
  • 9
  • Yes that is correct. But if we use `000-000000` then no need to change any format style. It will work fine. – Pedram Jan 01 '16 at 10:58
  • Yes that's why I have given answer to my own question. have you didn't check? – Pedram Jan 01 '16 at 11:24
0

One Simple way is described below

  1. Right click on the textbox
  2. Click on properties
  3. Click on option 'number'
  4. Finally select 'Custom' option under category section, and define your desired format in an expression like given below

=Format(Fields!FieldName.Value,"Any Format here...")

Pedram
  • 6,256
  • 10
  • 65
  • 87