Add column data into report in Reporting Services

  • Hi

    I am pretty new to SSRS and using Report Builder 3.0. I have been asked to create a report on one of our databases.

    I have the following data in the table to work from: Date, IndexNumber, Errorcode

    The report shows like:

    Date | IndexNumber | Errorcode

    12/05/2015 | 1 | 512

    12/05/2015 | 2 | 1024

    12/05/2015 | 3 | 1

    The problem I have is that each error has a "user friendly" description, but this is not in the table, or even in the database. I have read-only access to this database so can't add another table to reference the descriptions in the report.

    I have added another column "ErrorDesc" into the report at the DataSource setup query but this shows the same Description for each line in the report table. So it now shows like:

    Date | IndexNumber | Errorcode | ErrorDesc

    12/05/2015 | 1 | 512 | Description

    12/05/2015 | 2 | 1024 | Description

    12/05/2015 | 3 | 1 | Description

    So my question is: is there a way that I can add the different error descriptions so they show as needed, ie:

    Date | IndexNumber | Errorcode | ErrorDesc

    12/05/2015 | 1 | 512 | Error 2

    12/05/2015 | 2 | 1024 | Error 3

    12/05/2015 | 3 | 1 | Error 1

    Hopefully this makes sense...

    Thanks in advance!

    Ben

  • Create another dataset in the report that uses SELECT and UNION ALL to generate a list of Errorcode and ErrorDesc

    In the relevant textbox of the report set the expression to do a lookup on this dataset using ErrorCode from the main dataset

    *Editied*

    p.s. how many error codes are there?

    Far away is close at hand in the images of elsewhere.
    Anon.

  • Thanks for the nudge in this direction David. I'll give it a go.

    Sorry, should have added it to the question - there are 16 possible errors, so not too many.

    Thanks,

    Ben

  • In that case you use the following expression in a textbox

    =Switch(

    Fields!Errorcode.Value = 1, "Error 1",

    Fields!Errorcode.Value = 512, "Error 512",

    Fields!Errorcode.Value = 1024, "Error 1024",

    True,"Unknown Error")

    Far away is close at hand in the images of elsewhere.
    Anon.

  • Thanks David - work brilliantly!

    Appreciate the help.

    Ben

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply