Using the results of a Dataview search to populate suggester
values
#604
Replies: 1 comment
-
I have made a little progress. I still cannot get the Dataview listing to be passed through the The script is almost working. I can't figure out why If the second I added the line at the top - (FWIW, I have a ton of Here is the script:
And this is the template called by the QuickAdd Macro:
Any thoughts? |
Beta Was this translation helpful? Give feedback.
-
I'm trying to make sense of the code example given for the
suggester
function in a user script:Clearly I don't have a full grasp on how JS mapping works. Where is that '(file)' value coming from? Is it the result of the 'getMarkdownFiles()' function?
I am, however, trying to use a Dataview result (pages with a specific tag) as the values to offer in the
suggester
. I'm trying to make use of a set of pages for an RPG campaign. Each of the pages related to a city or town have the tag: ttrpg-burg. The script below is for creating a new item that will be located in a specific Burg. I want to provide the suggester listing if the item is created from a page that isn't already a Burg (if it is created from a Burg page, it just uses that page'sBurg
value.)Here is what I have (I've added comments to discuss success and failures):
It is very close to working. I just need to figure out how the
suggester
should be fed info to use & then return usable info from it.I know I'm missing something in the
suggester
function. I've tried a few variations on the burgListing and burgPages, but this is where I do get a listing in the suggester that is, at least, just the burg names - which, BTW, are also the names of the Markdown files for each Burg.I think I'm just not mapping the burgListing values to that object properly, or I'm not having them map properly within the suggester. I'm guessing, with the code above, even though I'm seeing the listing in the suggester, I'm returning the entire object as the result. With the way it is above, like I said, I get the listing of all the Burg pages (tagged:
#ttrpg-burg
) but it does not do any kind completion to select a choice (and throws an error even if I try to select an item.)Can someone help me figure out what it is I'm not getting correct? Thanks.
Beta Was this translation helpful? Give feedback.
All reactions