I couldn’t find this feature suggested elsewhere and haven’t been able to work out how to do this in the current implementation.
I would like to be able to create dynamic base views that are consistent in structure, but the view shows content that is a dynamically selected value of a given note property. To change the display, I’d use the view drop down to pick any one of the valid values. To all intents it would look like a normal base with lots of views. The key for me is the views are dynamically constructed based on the value in the view name.
Currently I create a view for each value that the note property can take, add a filter for that note property, and duplicate all the columns, sort and column size. This is OK, but doesn’t scale well - I have some properties that have over 100 entries, and more importantly, new entries have to be manually added.
In my vault, I use some notes as objects, where the content of the note is the frontmatter properties. I have multiple types of these object notes, for things like People, Organizations etc. Many of these property values in these object notes are links to other notes that are also objects notes.
For example, if I was tracking bands, band members, releases etc., it would look like this:
John Lennon.md
---
Type: Artist
Name: John Lennon
Instruments:
- "Vocals"
- "Rhythm Guitar"
- "Piano"
Bands:
- "[[Beatles]]"
- "[[Plastic Ono Band]]"
---
George Harrison.md
---
Type: Artist
Name: George Harrison
Instruments:
- "Vocals"
- "Lead Guitar"
Bands:
- "[[Beatles]]"
---
i.e. these are Artist objects, that capture things about the individual artist, including the bands played in.
The band objects would look like this:
Beatles.md
---
Type: Band
Name: Beatles
Founded: 1962
Disbanded: 1975
Style:
- "Pop"
etc.
In this scenario, I want to create a single base that has views that show all the members of a single band, and a view for all the bands I am tracking.
As implemented, I am creating something like the following:
filters:
and:
- Type == "Artist"
views:
- type: table
name: Beatles
filters:
and:
- Bands.contains("Beatles")
order:
- file.name
- Instruments
- type: table
name: "The Rolling Stones"
filters:
and:
- Bands.contains("The Rolling Stones")
order:
- file.name
- Instruments
etc.
My conceptual approach would be:
filters:
and:
- Type == "Artist"
views:
- type: table
name: isOneOf(Bands)
filters:
and:
- Bands.contains.views.name
order:
- file.name
- Instruments
Where the isOneOf()
concept is a list from the note property, and .contains.views.name
is for the list entry selected in the view. Hopefully that conveys the intent, despite probably being syntactically flawed.