Skip to content

How to use a specific property in template in dataview code block? #1417

Answered by Zachatoo
francisHugo asked this question in Help
Discussion options

You must be logged in to vote

The tags for the file won't be available for Templater to retrieve from the metadata cache until after the file is created, which is too late for your template code.

I would recommend storing the data in a variable and referencing it in multiple places in your template, something like this.

<%*
const inputTags = await tp.system.suggester(["1 tag3", "2 tag4", "3 tag5"], ["smallCarton", "bigCarton", "smallPlasticBox", "bigPlasticBox"], false,"input tags");
-%>
---
tags: 
  - tag1
  - tag2
  - #<% inputTags %>  
createdDate: <% tp.date.now() %>
---


## Dataview Query

```dataview
table createdDate
from #<% inputTags %>
```

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@francisHugo
Comment options

Answer selected by francisHugo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants