And it gives me all files with Groups somewhere in their folder name as an option, but is it possible to add one last choice?
For example, say my file does not correspond to any group at all. It would be nice to have a None option. Not sure if that’s possible with a multiple-links field, but even if this was a multi-select field instead, would it be possible to append extra options to a query?
Things I have tried
I’ve tried some things like, dv.pages().where(p => p.file.folder.includes("Groups")) || "None". Didn’t expect that one to work anyway. I also tried dv.pages().where(p => p.file.folder.includes("Groups")).push("None"). I don’t know how to create a string and make dataview register it as a file name.
If anyone knows how to do this, or even if it can be done, it’d greatly appreaciate it. Thanks!
Would it be an option to create a real page, matching your query and use that as a none-page? In other words an empty page, with just enough metadata to trigger your query, and some marker to denote it’s your none-page?
How do you plan to detect, in either case, that this is your none-option?
I could create a “None” page in this example, but I’d rather have it appear as text, “None”. I usually use the metadata menu modal to add metadata, and there is no “None” option for links. So I was wondering if I could conveniently append a “None” to the query.
I also tried dv.pages().where(p => p.file.folder.includes("Groups")).push(p => p.name = "None"), but that didn’t work.
One of the points I’m getting at is that if you add it to the query result, how will it not be a page link? And if that’s the case, then why not just make that page as dummy page, and rather deal with it specific in the other code related to your metadata menu modal?
I suspected that, so that kind of eliminates the option of adding a pure text entry anyways. So I do believe adding a dummy page into your query is one of the better options (as long as metadata doesn’t offer a none option itself). And given a “proper”/obivous page name like “None” or “-- None --”, you should be able to spot it rather easily in your frontmatter (or wherever you store the value.
Yeah, I see what you mean. I guess my real question was, is it possible to append an extra option to the existing options after the query? But then that’s more of a metadata menu question than a dataview question, I suppose.
So, not actually adding anything to the query. The query will always return a page. I was wondering if I could use the options generated by the query, and add an extra option to that. Like, push another option, not another page.
Again, I can always just go to the field and type “None”, and I guess I should just accept that as my solution. But if it’s possible…I guess in reality, I just really want to know if it is possible.