I have been working with Dataview for quite some time, but I’m unable to grasp how to utilize the metadata that’s connected to tasks in Dataview. For example, I wanted to be able to rapid log things that I’d like to buy in the future in my daily note by tagging it #Wishlist and adding an inline field for the price. Example:
- [ ] Journal cover that fits a B6 slim notebook (6.875in x 3.625in) [💲:: $10.00] #Notes/Wishlist
In my mind, adding the tag and field would give me the ability to create some sort of task “table” filtered by the tag #Wishlist with a column for the item, price, a backlink, etc. So I was surprised the most you can do is essentially filter by the fields using TASK dataview:
TASK
FROM ""
WHERE contains(tags, "#Notes/Wishlist")
Am I missing something? Is there method to display the inline fields and meta data of a task the way you would a TABLE?
Hey Noelle - I’m not a coder but have spent too much time on this website ! I can’t 100% explain everything, but here it goes:
Here is input data:
[ ] Journal cover that fits a B6 slim notebook (6.875in x 3.625in) [Cost :: $10.00] #Notes/Wishlist
[ ] Hat with pink feathers [Cost :: $50.00] #Notes/Wishlist
[ ] Another super-stylish something [Cost :: $80.00] #Notes/Wishlist
Dataview is very powerful - you CAN create a table to capture much of what I think you want. Try the following:
Table WITHOUT ID regexreplace(Tasks.text, "\[.*$","") as "Item", Tasks.Cost as "Cost"
FROM ""
WHERE file.tasks
FLATTEN file.tasks as Tasks
WHERE contains(Tasks.text, "#Notes/Wishlist")
A little explanation:
Table WITHOUT ID: this excludes the file name.
regexreplace(Tasks.text, “[.*$”,“”) as “Item”: This replaces all of the text after the “[”, essentially isolating the object in this case
FLATTEN is a function the allows an array (ie you have multiple tasks with a cost) to be handled as multiple individual lines. You can read up on this a bit in documentation.
WHERE contains…: This allows you to only see those task lines that contain your tag