SSRS Text Formatting Question

I have the following in SQL server to format an account number.

What is the syntax to do this in SSRS?


AcountNo = SUBSTRING(GLA.GLAccount,1,1) + '-' + SUBSTRING(GLA.GLAccount,2,7) + '-' + SUBSTRING(GLA.GLAccount,7,10)

Open in new window

LVL 8
ApexCoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Megan BrooksSQL Server ConsultantCommented:
It's very similar, but use double quotes instead of single quotes. Where are you going to use the formatted account number, in a derived column transformation?
0
blandyukCommented:
Not sure if Substring is in SSRS but you can also use:

Left([text], [num])
Right([text], [num])
Mid([text], [start], [len])
0
Megan BrooksSQL Server ConsultantCommented:
Yes, Substring is an SSIS function.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

ValentinoVBI ConsultantCommented:
There seems to be some confusion here.  Here's an attempt to set things straight.

Substring is not a function of SSRS.  But there is a function with a different name and exactly the same functionality: Mid()

The code snippet in attach is assuming that you're retrieving a field called GLAccount through your dataset.

Alternatively, you could produce this custom field in the query of your dataset.  In that case you can use exactly the same code as you've provided!

Regards,
Valentino.

=Mid(Fields!GLAccount.Value, 1, 1) + "-" + Mid(Fields!GLAccount.Value, 2, 7) + "-" + Mid(Fields!GLAccount.Value, 7, 10)

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
blandyukCommented:
I didn't think Substring was a function in SSRS, hence I provided the others above :)
0
Megan BrooksSQL Server ConsultantCommented:
It's not, I don't think. I misread the question.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.