I have two datasets.
One dataset has my contracts. This dataset has the following columns: contract_id, contract_name, client_id, start_date, end_date (it has more but these are the important ones). Example below :
contract_id(guid) | contract_name (string) | client_id(guid) | start_date | end_date |
---|---|---|---|---|
aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa | Contract 1 | 11a70fa0-b3cb-4cdf-9252-1ee8cc37551d | 01/01/2024 | 01/31/2026 |
bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb | Contract 2 | 11a70fa0-b3cb-4cdf-9252-1ee8cc37551d | 02/01/2024 | 02/08/2026 |
cccccccc-cccc-cccc-cccc-cccccccccccc | Contract 3 | 11a70fa0-b3cb-4cdf-9252-1ee8cc37551d | 03/01/2024 | 03/31/2026 |
The other dataset is for the contract_to_contract_type table. A contract can have multiple contract types assigned to it. The columns in that dataset are contract_type_id and contract_id. Example below.
contract_type_id (guid) | contract_id (guid) |
---|---|
gggggggg-gggg-gggg-gggg-gggggggggggg | aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa |
gggggggg-gggg-gggg-gggg-gggggggggggg | bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb |
gggggggg-gggg-gggg-gggg-gggggggggggg | cccccccc-cccc-cccc-cccc-cccccccccccc |
hhhhhhhh-hhhh-hhhh-hhhh-hhhhhhhhhhhh | aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa |
hhhhhhhh-hhhh-hhhh-hhhh-hhhhhhhhhhhh | bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb- |
iiiiiiii-iiii-iiii-iiii-iiiiiiiiiiii | bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb |
The contract to contract types dataset has row level security on the contract type id so that users will only have access to contract types within their permissions. So unfortunately contract type id must be a column in the dataset because of RLS.
This issue is that of course when I join the 2 datasets on contract_id if the user has rls permission to multiple contract types and a contract has multiple contract types then the contracts show up multiple times in the joined dataset. It’s important to get the duplicates out of the dataset because in the visual we’re using the contract name and the contract_id. Is there any way to get the duplicates out of the joined dataset?
An example of a visual would be one that lists the newest 5 contracts with a hyperlink that uses their contract id and client id.