x

How to check for #error when using Split in textbox expression

Hello all,

I have a dataset in a report that is returning a field which contains a comma-separated list of values. I want to display the first value in textbox1, the second value oin textbox2 and so on.

In textbox1 I use the expression

=Split(Fields!CSVList.Value, ",")(0)

In textbox2 I use the expression

=Split(Fields!CSVList.Value, ",")(1)

However, when the data in the field CSVList only contains one value, then Textbox2 displays #ERROR when the report is run.

How can I avoid displaying this error when there is no corresponding value in the Split array?

Thanks in advance.
more ▼

asked Feb 22, 2012 at 01:01 PM in Default

xnl28 gravatar image

xnl28
895 56 60 62

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

1 answer: sort voted first

@xnl28 Unfortunately, you are not doing it the right way. This seems to be the typical requirement of the matrix. Send the dynamic data from the SQL Server and handle it in SSRS with a Matrix.

Following are the links to help you out for the matrix implementation

http://sonalimendis.blogspot.com/2011/07/dynamic-column-rdls.html

http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/dynamic-column-names-and-fields-in-ssrs-
more ▼

answered Feb 22, 2012 at 03:27 PM

robbin gravatar image

robbin
1.6k 1 3 5

(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

By RSS:

Answers

Answers and Comments

SQL Server Central

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

Topics:

x113

asked: Feb 22, 2012 at 01:01 PM

Seen: 1063 times

Last Updated: Feb 22, 2012 at 03:54 PM