|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: 2 days ago @ 2:25 PM
Points: 9,
Visits: 35
|
|
I would like to find a way to setup a user table with logins (UserID) in one column and a department number in another column. A single user might be associated with multiple department numbers. When a report is run I would like the user to only see department data for the departments they are associated with in the table.
The article below is close to what I need except that a user is only associated with ONE department. I will have some people that are over multiple departments and will need access to all of those.
[url=http://www.mssqltips.com/sqlservertip/1743/dynamically-control-data-filtering-in-sql-server-reporting-services-reports][/url]
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 2:06 AM
Points: 7,104,
Visits: 7,169
|
|
I don't understand why you think the article you reference doesn't solve the problem. It certainly allows each user to be associated with (and therefor see data concerning) one or multiple offices, so the only change you appear to need is to change the word "office" to "department", ie it is purely a terminology difference.
Tom Que conclure à la fin de tous mes longs propos? C'est que les préjugés sont la raison des sots. (Voltaire, 1756)
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: 2 days ago @ 2:25 PM
Points: 9,
Visits: 35
|
|
| Thanks for the response! The example looks like it works for employees that would be associated with only one office. Mine will have multiple offices (departments). Am I missing something in the example?
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 2:06 AM
Points: 7,104,
Visits: 7,169
|
|
Look at the example beginning with this text:
the Report
In order to test the report, login as a particular user or launch Internet Explorer by right clicking on it, selecting Run As, and entering the credentials to use. I have setup two accounts for my test: Tom has access to all offices and Joe is restricted to just seeing two offices.
You'll see that when run by joe the report produces information for two offices, when run by tom it produces information for 6 offices. According to the article, the user-office association is defined in the table declared like this:
CREATE TABLE [dbo].[UserOffice]( [UserOfficeKey] [smallint] IDENTITY(1,1) NOT NULL, [UserAccount] [nvarchar](50) NOT NULL, [OfficeKey] [smallint] NOT NULL ) ALTER TABLE dbo.UserOffice ADD CONSTRAINT pk_UserOffice PRIMARY KEY CLUSTERED (UserAccount, OfficeKey) This table allows multiple rows for each user since there's no unique constraint on the UserAccount column, so each user can be associated with multiple offices.
Tom Que conclure à la fin de tous mes longs propos? C'est que les préjugés sont la raison des sots. (Voltaire, 1756)
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: 2 days ago @ 2:25 PM
Points: 9,
Visits: 35
|
|
| Thank you for the clarification. I appreciate your help!
|
|
|
|