What's the Point of Inline Fields in Tasks When it Comes to Dataview Queries?

Things I have tried

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:

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?

Thanks for any insight into this?

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"
WHERE file.tasks
FLATTEN file.tasks as Tasks
WHERE contains(Tasks.text, "#Notes/Wishlist") 

A little explanation:

  1. Table WITHOUT ID: this excludes the file name.
  2. regexreplace(Tasks.text, “[.*$”,“”) as “Item”: This replaces all of the text after the “[”, essentially isolating the object in this case
  3. 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.
  4. WHERE contains…: This allows you to only see those task lines that contain your tag

I hope this works for you / has been helpful…

1 Like

Wow. This was so helpful! And worked and helped me understand how to leverage fields in tasks! I appreciate your guidance!

Hopefully, we’ll get the functionality to turn the actual tasks into a table and get all the functionality you get in the list format in the future. :crossed_fingers:

1 Like

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