Solved

Expression in Report Builder 3.0

Posted on 2011-02-21
6
866 Views
Last Modified: 2012-08-13
I need to change a number to a text description in the expression area. Below is a sample of what I tested. I followed the help file suggestion without success.

I have a table that have numbers I need to convert to text for a description - 1 = "Dispatched"  0 = "Open"  2 = "Transferred"  and so on....

 Query Example Expression example
0
Comment
Question by:srodgers45
6 Comments
 
LVL 9

Accepted Solution

by:
sureshbabukrish earned 167 total points
ID: 34950580
use the expression
IIF(Fields!STATUS.Value= 1, "Dispatched",(IIF(Fields!STATUS.Value= 0, "Open",IIF(Fields!STATUS.Value= 2, "Transferred",[againIFFfunction or default value])))

IIF( condition, value if true, value if false)

always add the next condition in [value if false] till you have all the conditions in this expression.
0
 
LVL 21

Assisted Solution

by:Jason Yousef, MS
Jason Yousef, MS earned 167 total points
ID: 34951689
IIF constructions in SSRS always evaluate the entire expression,You can use a SWITCH instead, it'll work like a charm.

The Switch function is useful when you have three or more conditions to test.

=SWITCH(
                       
Fields!STATUS.Value = 0, "Open",
Fields!STATUS.Value = 1, "Dispatched",
Fields!STATUS.Value = 1, ""Transferred"

                      )


you can read about all SSRS expressions here

http://msdn.microsoft.com/en-us/library/ms157328.aspx


Hope that helps
Jason
0
 
LVL 27

Assisted Solution

by:planocz
planocz earned 166 total points
ID: 34963349
You can also use Code in your  reprts code tab
Like This

Public Function Stats(ByVal Pd As Integer) as String
  Select Case Pd
            Case 0
              Return "Open"
            Case 1
              Return "Dispatched"
             Case 2
              Return "Transferred"
End Select
        Return Nothing
   End Function

AND in the report textboxes or dcells the code would be....

=Code.Stats(Fields!STATUS.Value)
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 

Author Closing Comment

by:srodgers45
ID: 34966947
Thanks for all the solutions
0
 

Author Comment

by:srodgers45
ID: 34976163
I guess I closed this out to soon?  am I missing something?

Error Message Expression
0
 
LVL 21

Expert Comment

by:Jason Yousef, MS
ID: 34976258
could that be the error? e
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Help 27 69
SQL Stored Proc - Performance Enhancement 15 80
PolyServe for SQL server 13 44
Applying Roles in Common Scenarios 3 22
A recent questions about how to add SSRS named instances, couldn't find any that talks about SQL server 2008, anyway I decided to help by creating some screen shots. The installation is straightforward, you just pop the SQL server 2008 installati…
It is helpful to note: This is a cosmetic update and is not required, but should help your reports look better for your boss.  This issue has manifested itself in SSRS version 3.0 is where I have seen this behavior in.  And this behavior is only see…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question