views:

427

answers:

1

I've got an RDL report that is a roster -- it's a grid:

  • each row represents a day
  • each column represents a task
  • each cell contains the name of the person doing that task on that day.

I'm serving the reports off a MS Reporting Server.

I'd like to be able to highlight the cells that contain the name of the person viewing the report. So I really have two questions in one:

  • Is it possible to get the name of the person from the environment variables sent with their request to the report server? More generally, how can I see the list of environment variables that are sent?

If I can't get their name automatically, I could supply a report parameter that allows them to enter their name manually.

The second question is then:

  • Assuming I've got a name in a string, how do I conditionally format the cells in the report that have that string in them?

Thanks!

+2  A: 

Every object in rdlc has properties. You can assign them constant values or expressions. In this case you'll have to use IIf and simply compare Field!name with Parameter!name

This is going to look sth like this:

=IIf(Fields!name=Parameters!viewername, "Black", "Red");

PS> I forgot to mention that you have to assign it to the Color property of a textbox/cell.

There is a "globals" set of variables that contains "UserID" which is the domain account of the person executing the report. So to automatically compare the values to the domain account, you can assign this expression to the Color property of the field:

=IIf(Fields!name=User!UserID, "Black", "Red");

If they don't match exactly (because you're not including the domain name in the roster values) then you'd have to construct some kind of string comparison using the Like operator.

kubal5003