Dataview - column, if criteria X is met, then display Y

Hello !

What I’m trying to do

I would like to make dataview display in a column values according to criterias I would have set. The general idea is “if criteria X is met, then display Y”


For example :
My table would display two types of notes.

  1. Notes containing the tag “#summary
  2. Notes containing “#research”.

I can easily select them with FROM #summary or #research

That is a summary

#summary #tag2 #tag3

{content of the note}

That is a research note

#research #tag2 #tag3

{content of the note}

What I would like to is creating one column displaying “summary” if the note contain the tag #summary and “research” if the note contain the tag #research.

Table of research notes and summaries

Title Type
That is a summary Summary
That is a Resarch note Research

I would like to understand how to do that with several situations.
For example :
If the value of a key is <5, then display “Yes”. If the value of a key is >= 5, then display “No”.

Or when “priority = 3” then display “:red_circle:”. When “priority = 2” => “:yellow_circle:”. When 1 => “:white_circle:

Things I have tried

  • Google
  • Reading all the dataview functions
  • files.tags doesn’t do what I want as it display all the tags of a note, and I would like to learn how to make a “if x then display y” rule, if possible.
  • An alternative option would be to create a key on all #Research and #summary notes. For example making bulk replacement with Visual Studio Code of “#research” by “Type :: #research” and “#summary” by “Type :: #summary”. So I would be able to display de column “Type”. But again, I would love to learn what I’ve explained above.

How could I do that ?

1 Like

Sounds like the choice() function would be of use to you.

2 Likes

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