Wednesday, March 21, 2012

Formatting for Phone?

In my report I am combing 2 fields as

=Fields!PROPERTY.Value & " - " & Fields!PHONE.Value

this results in PropertyName - 5555551212

How would I add in formatting for phone so my resulting display is (555) 555-1212?

Jim Seidel wrote:

In my report I am combing 2 fields as

=Fields!PROPERTY.Value & " - " & Fields!PHONE.Value

this results in PropertyName - 5555551212

How would I add in formatting for phone so my resulting display is (555) 555-1212?

I'm doing this from memory, but something like this:

= "(" & Left(Fields!PHONE.Value,3) & ") " & Right(Left(Fields!PHONE.Value,6),3) & "-" & Right(Fields!PHONE.Value,4)

The full expression would be this:

= Fields!PROPERTY.Value & " - " & "(" & Left(Fields!PHONE.Value,3) & ") " & Right(Left(Fields!PHONE.Value,6),3) & "-" & Right(Fields!PHONE.Value,4)|||Awesome Memory, it worked perfectly !|||Great, glad I could help. You'll get used to it. Does it make sense?

Getting the middle characters is a little awkward. I can't remember whether there is a Mid function defined or not, so I just use that.|||Yes, like you say, it just comes with practice

No comments:

Post a Comment