Dataview: How do I use "contain" if there are two true options?

Topic

Summary
  • How to transform a Done field content which is ‘not started’, ‘almost done’ or ‘done’ into a red, yellow or green circle icon?

Test

Summary
  • dataview: v0.5.46

Input

Summary

dictionary files:

  • Location: “100_Project/02_dataview/Q20_Flags/Q20_test_data03”

folder: 03

  • filename : dic_19800306
---
Date: 1980-03-06
Done: "done"
---



folder: 04

  • filename : dic_19800406
---
Date: 1980-04-06
Done: "almost done"
---



folder: 05

  • filename : dic_19800506
---
Date: 1980-05-06
Done: "not started"
---



DQL10: Use {key1:value1, …}[Done]

Summary

Code DQL10

Summary_code
title: DQL10 => Use {key1:value1, ...}[Done]
collapse: close
icon: 
color:
```dataview
TABLE WITHOUT ID
      file.link AS "Document",
      Status AS "Status"

FROM "100_Project/02_dataview/Q20_Flags/Q20_test_data03"
WHERE Done != null

FLATTEN {
    "not started": "🔴",
    "almost done": "🟡",
    "done": "🟢"
}[Done] AS Status
```

Screenshots(DQL10)


DQL11: Use object(key1, value1, …)[Done]

Summary

Code DQL11

Summary_code
title: DQL11 => Use object(key1, value1, ...)[Done]
collapse: close
icon: 
color:
```dataview
TABLE WITHOUT ID
      file.link AS "Document",
      Status AS "Status"

FROM "100_Project/02_dataview/Q20_Flags/Q20_test_data03"
WHERE Done != null

FLATTEN object(
    "not started", "🔴",
    "almost done", "🟡",
    "done", "🟢"
)[Done] AS Status
```

Screenshots(DQL11)


Reference

Summary

Emoji

Q01_Sum

Q19_Workout


1 Like