This is a migrated thread and some comments may be shown as answers.

String Manipulation

2 Answers 98 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Matthew
Top achievements
Rank 1
Matthew asked on 08 Sep 2012, 10:10 PM
Hello,

I have a table pulling data from a stored procedure, but due to the way the database was set up, some of the strings were cut off. I cannot change the structure of the database, so I was wondering if it was possible to add the part of the string cut off in the [=Fields.whatever] part of the cell.

Here's a simplified example of what I mean....

The table was created like this:
CREATE TABLE ThingColor(
id int PRIMARY KEY,
thing varchar(20),
color varchar(5))

And data inserted:
INSERT INTO ThingColor
VALUES (1, 'sky', 'blue'), (2, 'sun', 'yello');

My stored procedure calls 'thing' and 'color', but the "yello" is missing its w. When I get to the Telerik Report table, is there something similar to an if statement function where, if the string = 'yello', then display 'yellow', that I can add to my [=Fields.color] box?

2 Answers, 1 is accepted

Sort by
0
Accepted
Ed Lance
Top achievements
Rank 1
answered on 10 Sep 2012, 10:58 PM
Well it's too bad you have to resort to something like this, but if you don't have too many entries to correct, I guess it's OK, but I would do it in the stored procedure rather than in reporting.   SQL Server will process it more efficiently, and your report then isn't concerned with data oddities.
CASE [color]
    WHEN 'yello' THEN 'yellow'
    ELSE [color]
END AS color

0
Matthew
Top achievements
Rank 1
answered on 12 Sep 2012, 01:45 PM
It's just the one entry, so it's not that bad. And this solutions beats what I was asking for, seeing as I'll probably be using SQL more in the future than Telerik Reporting.

Thanks for the help!
Tags
General Discussions
Asked by
Matthew
Top achievements
Rank 1
Answers by
Ed Lance
Top achievements
Rank 1
Matthew
Top achievements
Rank 1
Share this question
or