Is there a way in the report designer to format a field that contains names to display the name as a proper name rather than in all caps as stored in the db
Thanks.
Is there a way in the report designer to format a field that contains names to display the name as a proper name rather than in all caps as stored in the db
Thanks.
convert all caps names to proper names
Lewishsu
By proper name do you mean a name with just the first letter capitalized You could write an expression for it. It would look something like this:
=iif(Fields!yourfield.Value.ToString.ToUpper = Fields!yourfield.Value.ToString, Fields!yourfield.Value.ToString.Chars(0).ToString & Fields!yourfield.Value.ToString.SubString(1, Fields!yourfield.Value.ToString.Length, Fields!yourfield.Value)
The expression assumes that the field will never be null and it will always be at least 2 characters long. If these aren't true it gets a little more complicated. Hopefully this puts you on the right track.
rute01
In Report Designer, add the following Function to the Code section of the Report properties dialog.
If (str = Nothing Or str.Length = 0)
Return String.Empty
If str.Length = 1 Then
Return str.ToUpper()
Else
Return str.Substring(0, 1).ToUpper() & str.Substring(1).ToLower()
End Function
This method is then called using the following expression.
You can also do this directly in the SQL query. This example uses the SQL Server 2005 AdventureWorks database.
For more information on custom code:
Using Custom Code References in Expressions (Reporting Services)
How to: Add Code to a Report (Report Designer)
Modderrhu
http://vyaskn.tripod.com/code.htm#propercase
I haven't tried this sp yet, because I use Oracle as Datasource which has the function INITCAP..
so just rewrite your sql-statement:
select initcap(name), customerid from customers
or if you user MSSQL-Server as Source create the function in the link