Help request to filter / flatten results of this dataview table.
What I’m trying to do
I am attempting to return a table of flattened/filtered values queried from frontmatter yaml ‘fields’ property of my file class records (that were created by MetaDataMenu)
For example “Templates/Classes/Place Class.md”
---
limit: 100
mapWithTag: false
icon: map-pinned
tagNames:
filesPaths:
bookmarksGroups:
excludes:
extends: Location Class
savedViews:
favoriteView:
fieldsOrder:
- FvARJl
- oytXF0
- P3IUZs
- EWeWKa
- vfsv0H
- GWsHPn
- H5cHzU
- o2JJR6
- WtahOf
- Z1fiPv
- AWLKUK
- 1P0bg1
version: "2.119"
fields:
- name: place-area
type: Number
options: {}
path: ""
id: Z1fiPv
- name: place-name
type: Input
options: {}
path: ""
id: FvARJl
- name: place-city
type: Select
options:
sourceType: ValuesListNotePath
valuesList: {}
valuesListNotePath: Templates/Selections/City Names.md
path: ""
id: EWeWKa
- name: place-state
type: Select
options:
sourceType: ValuesListNotePath
valuesList: {}
valuesListNotePath: Templates/Selections/State Names.md
path: ""
id: vfsv0H
- name: place-country
type: Select
options:
sourceType: ValuesListNotePath
valuesList: {}
valuesListNotePath: Templates/Selections/Country Names.md
path: ""
id: H5cHzU
- name: place-structures
type: Number
options: {}
path: ""
id: AWLKUK
- name: place-outline
type: YAML
options: {}
path: ""
id: 1P0bg1
- name: place-county
type: Select
options:
sourceType: ValuesListNotePath
valuesList: {}
valuesListNotePath: Templates/Selections/County Names.md
path: ""
id: GWsHPn
- name: place-continent
type: Select
options:
sourceType: ValuesListNotePath
valuesList: {}
valuesListNotePath: Templates/Selections/Continent Names.md
path: ""
id: WtahOf
- name: place-number
type: Input
options: {}
path: ""
id: oytXF0
- name: place-street
type: Input
options: {}
path: ""
id: P3IUZs
- name: place-postcode
type: Input
options: {}
path: ""
id: o2JJR6
---
This dataview table shows my metadata menu class files with any value list selection notes that are defined for ‘select’ or ‘multi’ type fields of the class.
TABLE file.frontmatter.fields.options.valuesListNotePath AS "Value Notes"
FROM "Templates/Classes"
However the table column “ValueNotes” result it has - entry for every field of the class, even those without valuesListNotePath property, and I would like to omit them, but have not had success with my many attempts. Perhaps dataviewjs necessary here?
Things I have tried
Where filter and flatten in dataview…
TABLE file.frontmatter.fields.options.valuesListNotePath AS "Value Notes"
FROM "Templates/Classes"
WHERE file.frontmatter.fields.options.valuesListNotePath != null
FLATTEN "Value Notes"
Convert into dataviewjs and trying to inspect Object…
dv.table(["File", "Values Notes"], dv.pages('"Templates/Classes"').where(p => Object(p.file.frontmatter.fields?.options?.valuesListNotePath)).map(p => [p.file.link, p.file.frontmatter.fields?.options?.valuesListNotePath.map(p => p != null)]));
Feels like I am getting close but this language is not my area of expertise yet.