all groups > sql server reporting services > june 2007 >
You're in the

sql server reporting services

group:

Replace string inside value


Replace string inside value ApeX
6/28/2007 2:23:09 AM
sql server reporting services: Hi all, i have a question, i'm making a report in visual studio, where
i have a textbox which i fill with a value from a database and i wanna
know how you can change certain strings withing the filled value....
example:

This is the expression for the textbox:

=First(Fields!MyFieldName.Value, "Parametri")
=Replace(Fields!MyFieldName.Value.ToString(), "date", "current date")

So, the thing is, i've filled my textbox with a value from a database,
which is in my case, the value is a simple sentence...which has a word
'date' in it...so my question is how can i search that value
(sentence) and find the word "date" and replace it with something, for
example, today's date..?

That means if my textbox value is "bla bla bla date bla bla bla", i
wanna be able to change the word "date" to today's date or any other
word...so that in the report preview instead of "date" it says today's
date...

THANX!
Re: Replace string inside value EMartinez
6/29/2007 7:50:10 PM
[quoted text, click to view]


What you have is pretty close to correct. You should be able to use
something like this:
=Replace(CStr(Fields!MyFieldName.Value), "date", "current date") -or-
if you want the actual date time, you could use:
=Replace(CStr(Fields!MyFieldName.Value), "date", CStr(Now()))
Hope this helps.

Regards,

Enrique Martinez
Sr. Software Consultant
AddThis Social Bookmark Button