Splitt the comma delimited string in ssrs Expression

Hi, in my ssrs Report i need to disply assetnames one by one in textBox from comma separated string field I have field Assetname-------->(abc,pqr,xyz,.........) i want to disply Assetname in the textBox as like this abc pqr xyz ......... i.e, split the string where comma exist and disply one by on can plz help me to write expression?
more ▼

asked Oct 13, 2011 at 08:30 AM in Default

ANJI gravatar image

14 10 14 14

(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

If you need to use expression for each box then you can use

=Assetname.Split(",".ToCharArray())(0) ' for box 1' Text property
=Assetname.Split(",".ToCharArray())(1) ' for box 2' Text property 
=Assetname.Split(",".ToCharArray())(2) ' for box 3' Text property 
=Assetname.Split(",".ToCharArray())(3) ' for box 4' Text property 
' etc

Usually though it would be better to tidy up a little and have a routine to do the split just once and return a string array, which members you can then use (to avoid calling a split every step of the way).

more ▼

answered Oct 13, 2011 at 09:56 AM

Oleg gravatar image

15.9k 2 4 24

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.



asked: Oct 13, 2011 at 08:30 AM

Seen: 1731 times

Last Updated: Oct 13, 2011 at 08:30 AM