Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Expression in Report Builder 3.0

Posted on 2011-02-21
6
Medium Priority
?
883 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 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
Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

 

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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Written by Valentino Vranken. Introduction: The first step of creating a SQL Server Reporting Services (SSRS) report involves setting up a connection to the data source and programming a dataset to retrieve data from that data source.  The data…
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…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

879 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