Sjharrison Sjharrison - 1 month ago 8
SQL Question

Visual Studio 2010 Reporting - Replace String Expression Issue

I'm using visual studio 2010 to create a report, the data is being used from a SQL database

One particular set of data is being returned as integers instead of text, therefore I want to be able to do a statement where if the integer is 1 then set it as "Random" if 2 then set it as "Question" for example

I've tried the following but been unsuccessful

=Replace(Fields!new_IssueType.Value,"1","Issue")
=Replace(Fields!new_IssueType.Value,"2","Complaint")
=Replace(Fields!new_IssueType.Value,"3","FM Complaint")
=Replace(Fields!new_IssueType.Value,"4","Rejected")


I'm new to creating these expressions so I apologise if this question is a simple fix.

Answer Source

Try using this code:

=IIF(Fields!new_IssueType.Value = "1","Issue",IIF(Fields!new_IssueType.Value = "2","Complaint",IIF(Fields!new_IssueType.Value="3","FM Complaint",IIF(Fields!new_IssueType.Value="4","Rejected",""))))