Solved

Expression in Report Builder 3.0

Posted on 2011-02-21
6
848 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:huslayer
huslayer 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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:huslayer
ID: 34976258
could that be the error? e
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

A recent question popped up and the discussion heated up regarding updating a COMMENTS (TXT) field in a table using SSRS. http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/MS-SQL_Reporting/Q_27475269.html?cid=1572#a37227028 (htt…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now