Extracting Value from Suggester Function

What I’m trying to do

Holroy (thank you!!!) helped me with the following code, but I can’t seem to extract the result of the suggester function. I would like to output the person as a link, but the variable (selectedPerson) doesn’t seem to be defined.

<%*
const dv = app.plugins.plugins.dataview.api

const result = await dv.query(`
TABLE file.name, title, email, cell
FROM "ForumStuff/f65/f65535"
WHERE entity = "CompanyA"
  AND file.link
`)

if (result.successful ) {
  console.log(result.value.values)
   const selectedPerson = await tp.system.suggester(
     r => r[1], result.value.values)
   tR += JSON.stringify(selectedPerson)

} else
  dv.paragraph(`~~~~\n${ result.error }\n~~~~\n`)
%>

Things I have tried

I thought one of following would work but to no avail.
Person: <% selectedPerson %>
Person <% selectedPerson[1] %>

Thanks for any guidance.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.