VS2012 SSRS - Activities - is there a way to have icons for activities? RRS feed

  • Question

  • Hi all,

    I am building a report in VS2012 and I have a table for my activities which then show tasks, appointments, emails etc.. I was wondering whether instead of activity type column I could have icons for the activities? Does anyone know whether this is difficult to implement?

    Thanks so much


    Tuesday, December 2, 2014 3:52 PM

All replies

  • This should be relatively easy to achieve with some conditional logic in the report. You could either:

    1. Add an image to each row, and use an expression to set the source, based on the activity type
    2. Add one image of each type to each row, and set the Visible property so only one shows, based on the activity type

    The former option seems neater to me

    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

    • Proposed as answer by Mamatha Swamy Tuesday, December 2, 2014 5:29 PM
    Tuesday, December 2, 2014 4:56 PM
  • Thanks Mamatha, the 2nd option sounds good, may I ask for little clarification? This is how my table is now

    1) Do I duplicate 6 additional rows as per my original row?
    2) Do I select Row visibility  or just click on [activitytypecode] and then click Text Box Properties?

    Any info would be much appreciated! Thanks so much


    Tuesday, December 2, 2014 6:32 PM
  • Thanks to David for the options.

    For Option 2, Add a column with all activity images (email,phone,letter etc) and set all images visibility to default to False. Then, depending on activitytypecode use expression enable the appropriate image's visibility

    Option1: Is a better option... use expression to show relevant image... pls ignore any syntax errs.. not using VS. Replace the image names with path or use names if you are adding images as report resources.

    =Iif(Fields!ActivityTypeCode.Value = "4202", "Email.jpg", IIF(Fields!ActivityTypeCode.Value = "4201", "Appointment.jpg", "Phone.jpg"))

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


    If my response helps you in finding your answer then please click 'Mark as Answer' and 'Vote as Helpful'

    • Proposed as answer by Mamatha Swamy Tuesday, December 2, 2014 7:54 PM
    Tuesday, December 2, 2014 7:54 PM
  • Thanks guys, I am still struggling a little bit.. I am pretty sure I am doing something wrong here... if I go with Option 1

    1) do I first create another column then drag an image from Toolbox into it?

    2) then import my images as per below?

    3) and then set Visibility and add this expression you provided? Visibility > Show or Hide based on an expression?

    =Iif(Fields!ActivityTypeCode.Value = "4202", "Email.jpg", IIF(Fields!ActivityTypeCode.Value = "4201", "Appointment.jpg", "Phone.jpg"))

    Tuesday, December 2, 2014 9:26 PM
  • Hi,

    Click on Fx (Expression editor) next to image selector in your screen shot. You don't need visibility expression for first option. Second option may require you to hide show columns

    Write you expression.

    =Iif(Fields!ActivityTypeCode.Value = "4202", "imagename", IIF(Fields!ActivityTypeCode.Value = "4201", "imagename", "imagename"))


    Kalim Khan

    • Proposed as answer by Kalim Khan Wednesday, December 3, 2014 6:30 AM
    Wednesday, December 3, 2014 6:30 AM
  • Hi Kalim,

    I am getting an error.. where am I going wrong here??? I tried both ways 2 options:

    Option A

    column 1:  insert image from toolbox and add expression? =Iif(Fields!ActivityTypeCode.Value = "4202", "appointment", IIF(Fields!ActivityTypeCode.Value = "4201", "phone", "task"))
    column 2: just select field activitytypecode

    or Option B?

    column 1:  insert image from toolbox and click "Use this image" for appointment (then do this for all other images, which means 3 rows in total)
    column 2: add the expression: =Iif(Fields!ActivityTypeCode.Value = "4202", "appointment", IIF(Fields!ActivityTypeCode.Value = "4201", "phone", "task"))







    Wednesday, December 3, 2014 1:46 PM
  • I tried few other options but still not getting it to work... any thoughts where am I going wrong.....

    Wednesday, December 3, 2014 9:36 PM
  • is it not working because it is CRM online?

    Thursday, December 4, 2014 3:10 AM
  • Insert an Image Box in the table cell. Click on Image Properties.

    Click on Import button to Embed the Images in the report. The names of the Images imported should be Task, Phone and Appointment.

    click on Fx Button besides Import and paste this expression and it will work just fine

    =switch(Fields!ActivityTypeCode.Value  = 4202, "Appointment", Fields!ActivityTypeCode.Value  = 4212, "Task", Fields!ActivityTypeCode.Value = 4201, "Phone")

    Regards, Saad

    Thursday, December 4, 2014 6:40 AM
  • Hi Saad,

    I tried but still find the error. I am using Online CRM does it matter? This is the error I get below

    Thursday, December 4, 2014 3:33 PM
  • make sure this field exists in your dataset. You can go to datasets and select the field from there while writing the expression.

    Regards, Saad

    Friday, December 5, 2014 4:11 AM
  • can you explain what you mean by this? I think this is where the disconnect is....
    Friday, December 5, 2014 5:51 AM
  • In Switch Expression remove Fields!ActivityTypeCode.Value.

    Click on Fields(YourDatasetname) and select the activitytypecode field from values and click ok. Hope this will resolve your issue.

    Please refer the screenshot below:

    Regards, Saad

    Friday, December 5, 2014 8:44 AM
  • Hi Saad, we are getting there! thanks so much!! now though the image doesn't show up.. I used

    =switch(Fields!activitytypecode.Value  = 4202, "appointment", Fields!activitytypecode.Value  = 4212, "Task", Fields!activitytypecode.Value = 4201, "phone")

    I get the bad image now.. any idea what could be causing this?

    Friday, December 5, 2014 12:23 PM
  • Refer this. Test your report on CRM it will work fine.

    Regards, Saad

    • Edited by Mohd Saad Friday, December 5, 2014 1:08 PM
    Friday, December 5, 2014 1:01 PM
  • Thanks, it works. but what I notice is that every activity shows image of only TASK so for example my appointment still shows my Task image

    =switch(Fields!activitytypecode.Value  = 4202, "Appointment", Fields!activitytypecode.Value  = 4212, "Task", Fields!activitytypecode.Value = 4201, "Phone")

    I even renamed all images with capital letters to match code: Apppointment, Task, Phone

    Friday, December 5, 2014 1:18 PM
  • share your Image Properties

    Regards, Saad

    Friday, December 5, 2014 1:21 PM
  • below are my Image Properties.. I also noticed when I run report in CRM it shows that 1 image but then when I download to PDF I still get that X

    Friday, December 5, 2014 1:31 PM
  • Remove this Image Box from the cell and try to do the same with another one. Also In Size Property ensure it's Fit proportional.

    Regards, Saad

    Monday, December 8, 2014 6:04 AM