Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Expression in Report Builder 3.0

Posted on 2011-02-21
6
Medium Priority
?
878 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 9

Accepted Solution

by:
sureshbabukrish earned 668 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 668 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 664 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
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

722 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