Reputation: 3
I would like to create a scatterplot or bubble graph that will show one point for an employee's annual salary based on total years worked for the company and compare it to all of the other employees.
However, the employee logging in will only be able to see detailed information about their point. All other points need to be anomymized.
I have a control table of employees that is using RLS with a user role. when the user logs in, They can only see their salary data from other tables joined to the employee control table.
I would like to add a table with all other employee's salary info without their Employee IDs, Names, ETC to display all in a scatter plot.
Thanks.
Upvotes: 0
Views: 556
Reputation: 2051
Building on what is shown in this post by Darren Gosbell1, here is a suggestion for you. My model involves three tables, one with the interesting information and two which are the employee dimension, vertically partitioned into public and private columns.
Salary & Experience =
DATATABLE(
"Employee ID", INTEGER, "Salary", CURRENCY, "Experience", INTEGER,
{
{1, 100000, 20},
{2, 80000, 5},
{3, 75000, 0},
{4, 120000, 6},
{5, 45000, 35}
}
)
Employees (Public) =
DATATABLE(
"Employee ID", INTEGER, "Sex", STRING,
{
{1, "F"},
{2, "M"},
{3, "F"},
{4, "M"},
{5, "F"}
}
)
Employees (Private) =
DATATABLE(
"Employee ID", INTEGER, "Name", STRING,
{
{1, "Me"},
{2, "Fred"},
{3, "Sally"},
{4, "Bob"},
{5, "Irene"}
}
)
We just then set up one-to-many relationships between 'Employees (Public)' -> 'Salary & Experience' and 'Employees (Public)' -> 'Employees (Private)' using the [Employee ID] column.
We can create some roles which filter the 'Employees (Private)' table based on the identity of the current user.
Then we make the scatter plot as you described, being careful to use a unique attribute from the public partition of the employees table as the details for the plot. Note that when viewing as employee "Me" I can see name of that employee, but not another employee.
I'm sure that your filter you define in the roles will me more interesting than mine.
Upvotes: 1