Hello all
I have set up filtering on a table and have it working nicely - but it takes A LOT of computed columns. If any experts have time, I would love their opinions / advice on whether they have a better / more efficient way.
I don’t want to use the inbuilt filters as they filter for all logged in users - and I prefer to use the choice component.
I have a “Detail” table - with lots of rows. Each row can have multiple tags applied and separately, multiple locations. Tags and locations are set in two separate text columns, using Row IDs of separate (Tags and Location tables)
I would like to be able to filter the table as follows:
- No tag / location selected - show everything
- One or more tags selected, but no locations selected - show every entry that contains one or any of the selected tags
- One or more locations selected, but no tags selected - show every entry that contains one or any of the selected locations
- If tags and locations are selected for filtering - then only rows that contain any of the selected tags AND any of the selected locations are returned.
This is how I have set up the tables.
Separate tables for Locations and Tags - with Row IDs
Detail table
Columns for description / Date / Author etc
Columns for tags as follows
- Tag IDs (Multiple)
- If 1 is empty - then *
- Split Text of 2
- Multiple relation of 3 to Tag table Row ID
- Look up Tag name from relation in 4
Columns for locations
- Location IDs (Multiple)
- If 1 is empty - then *
- Split Text of 2
- Multiple relation of 3 to Location table Row ID
- Look up location name from relation in 4
Query table (most likely in the user table)
Tag IDs to filter by (Set using a multiple choice component in the UI)
Location IDs to filter by (Set using a multiple choice component in the UI)
Computed columns for tags
- All tag IDs (Joined List of all available tags - from tags table)
- Add a * to 1 (Template column)
- If 1 is empty - then 2. Otherwise 1.
- Split text 3
- Relation - where 4, matches IDs in Tags split text on the detail table
- Look up row IDs of 5
Computed columns for locations
- All Location IDs (Joined List of all available tags - from Locations table)
- Add * to 1
- If 1 is empty - then 2. Otherwise 1
- Split text 3
- Relation - where 4, matches values in Location split text on the detail table
- Look up row IDs of 5
FINAL QUERY
Get all rows from the detail table.
Filter by Row ID is included in - this row> item 6 (Tags) AND Row ID is included in - this row>item 6 (Locations)
Appreciate there is a lot here, and as I say it is working as I want - but keen to hear others thoughts.
Thanks
Andrew