none
Change Image Displayed Depending on Data in Result Set RRS feed

  • Question

  • Hi all. I am using Visual Studio 2005 with reporting service. The final report will be displayed on a SharePoint portal for a customer.

    Basically, I need my report to display different images depending on the values in a column from my query. Simple example:

    Query returns:
    Item      Type
    ____     _______
    1            "Car"
    2            "Bus"
    3            "Truck"

    My report will have 3 images for each item.  I already have the images/icons created. So for each item I want it to look at the ResultSet corresponding to it's item number and display the appropriate jpg file (Car/Bus/Truck). And each time the report is run the items could be assigned a different Type.

    Is there a way to do this either through the GUI or programmatically? My only experience has been with the GUI in Visual Studio so far, I rarely touch the code behind the scenes.

    Further, what is the best method to swap between the different Types? Should I overlay each 3 icons and just set only 1 to Hidden=False??

    Thanks!
    Jamal
    Monday, January 12, 2009 12:22 PM

Answers

  • You can do this directly in the report definition.  Add an image report item to a column in your table and set the Source property to the correct value based on where you images are coming from.  In you case, it sounds like you are embedding the images in the RDL itself.  Then set the Value property of the image to an expression.  You can use the data fields of your result set to select which image will be displayed on each row.
    Monday, January 12, 2009 4:15 PM
    Moderator