Hi
I know this subject is quite old, but I think that sharing my use case might help some people in the future.
I have 2 tables : Person and Car with a 1 to many relationship. These 2 tables are in 2 different PostgreSQL databases.
The idea is to be able to select several people and then show the cars that they own.
2 datasets have to be created separatly, because the Car table contains literaly millions of rows, meaning that creating a Spice is not an option.
The exact method described by darcoli can be used to select several rows in Person and create different calculated fields to filter the Cars.
Problem being that using calculated fields to filter a dataset containing millions of rows isnât an option either.
The trick is to use custom SQL and parameter mapping to filter the table :
- Use custom SQL to get data from the âCarâ table :
SELECT id, name, ownerId
from Car
-
Create a single string parameter in the dataset named filter_ids with the default value being a comma
-
Edit the SQL query to include the parameter
SELECT id, name, ownerId
from Car
where ownerId = any(string_to_array(<<$filter_ids>>, ','))
- Go back to the analysis in the parameter section and map the parameter âfilter_idsâ to âselected_item_idsâ
Then you should be able to select any Person in the table and have the Car dataset updated accordingly