none
replacing field display output RRS feed

  • Question

  •  

    I'm very new at, but starting to learn SQL.  In moving from very simple reports in VS 2005, I now need to know how to change what a field displays.

     

    For example, a Project Status field (pastat) is stored as an integer (1=open, 2=closed, etc.).  Rather than display to the end user 1,2,etc., I'd like to replace it with a string of my choosing (ie. Open, open, O, etc.).  I'm running into this with text fields as well.  I suppose in some instances, I could find another table that provides this translation and JOIN them, but there's got to be a very simple way to do this.

     

    Can you help?

    Friday, October 19, 2007 6:15 PM

Answers

  • Sure.  You can create a simple Code function to do this.  But try the Choose or Switch functions; you probably don't need to in this case. For example:

     

     

    Code Block


    =Switch(Fields!Order_Quantity.Value < 5,
    "low",

            Fields!Order_Quantity.Value < 20,"medium",

            Fields!Order_Quantity.Value >= 20,"high")

     

     

    HTH,

     

    >L<

    Saturday, October 27, 2007 6:33 AM

All replies

  • right-click on the field, then select 'Expression'

     

    =IIF(value=0, "open", IIF(value=1,"closed", IIF(etc.))

     

     

    Also see:

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

    Monday, October 22, 2007 10:09 AM
  • is there not an easier way if there are several possible reponses (ie. replace a,a1;b,b1,...)?

     

    Thursday, October 25, 2007 8:31 PM
  • Sure.  You can create a simple Code function to do this.  But try the Choose or Switch functions; you probably don't need to in this case. For example:

     

     

    Code Block


    =Switch(Fields!Order_Quantity.Value < 5,
    "low",

            Fields!Order_Quantity.Value < 20,"medium",

            Fields!Order_Quantity.Value >= 20,"high")

     

     

    HTH,

     

    >L<

    Saturday, October 27, 2007 6:33 AM
  • that's what I was looking for -- thank you so much!

     

    Monday, October 29, 2007 2:54 PM