Checking Frontmatter variable if contains/isin s specific key word list
Hi guys,
i need your help by editing/running a dataviewjs query.
Several trials didn’t help and googling didn’t help me as well in that case.
My Setup:
I’m using contact markdown files with standarized frontmatter variables and project overview markdown files where all realated notes and KPIs, stakeholders and so on linked to:
The upper code don’t work and returns the following error message
“”"
Evaluation Error: TypeError: Cannot read properties of undefined (reading ‘contains’)
at eval (eval at (plugin:dataview), :4:33)
at Array.filter ()
at Proxy.where (plugin:dataview:9418:39)
at eval (eval at (plugin:dataview), :4:3)
at DataviewInlineApi.eval (plugin:dataview:19734:16)
at evalInContext (plugin:dataview:19735:7)
at asyncEvalInContext (plugin:dataview:19745:32)
at DataviewJSRenderer.render (plugin:dataview:19766:19)
at DataviewJSRenderer.onload (plugin:dataview:19350:14)
at DataviewJSRenderer.e.load (app://obsidian.md/app.js:1:864580)
“”"
My plan is to show all responsible stakeholders related to that project based on the frontmatter variable “projects_involved” of the contact markdown file.
Due to the fact, that one contact can involved in more than one project, i have to use a function like “contains” or “isin”. → “is a item in in projects_involved equal to project”
There might be more errors, then the one I’ll mention, but first of all please envlise all of your markdiwn, code blocks and queries in four backticks, ````, in the forum post, as that shows us what you’ve actually written in your notes.
Ok, you need at least to do p.project_involved?.contains(...) to allow for notes not having that field defined.
I think I see some other errors too, but can’t tell for sure before I see your markdown properly formatted within four backticks.
The upper code don’t work and returns the following error message
“”"
Evaluation Error: TypeError: Cannot read properties of undefined (reading ‘contains’)
at eval (eval at (plugin:dataview), :4:33)
at Array.filter ()
at Proxy.where (plugin:dataview:9418:39)
at eval (eval at (plugin:dataview), :4:3)
at DataviewInlineApi.eval (plugin:dataview:19734:16)
at evalInContext (plugin:dataview:19735:7)
at asyncEvalInContext (plugin:dataview:19745:32)
at DataviewJSRenderer.render (plugin:dataview:19766:19)
at DataviewJSRenderer.onload (plugin:dataview:19350:14)
at DataviewJSRenderer.e.load (app://obsidian.md/app.js:1:864580)
“”"
My plan is to show all responsible stakeholders related to that project based on the frontmatter variable “projects_involved” of the contact markdown file.
Due to the fact, that one contact can involved in more than one project, i have to use a function like “contains” or “isin”. → “is a item in in projects_involved equal to project”
What if you use projects_involved in both places, and not only project_involved?
The question mark allows javascript to bail out gracefully, if (or when) the field doesn’t exist. Like when you check all other files which are not supposed to match (and when you’ve got a small, but crucial typo).