Dataview: how to exclude specific tag

Steps to reproduce

  • I use Dataview plugin to list all the notes within a folder, named “MacBook”. I would like to list only notes without tag: #Mac/App as the list of wanna-buy-apps.

```dataview table image, price, purchase_date from "MacBook" where file.tags != "#Mac" and file.tags != "#Mac/App" ```

  • I also tried where file.tags != "Mac/App" and where file.tags != #Mac/App but none of these actually work.

Question

  • What is the actual code to exclude a nested tag ?

Environment

  • Operating system: macOS Monterey Version 12.3
  • Debug info:
    SYSTEM INFO:
    Obsidian version: v0.14.3
    Installer version: v0.12.15
    Operating system: Darwin Kernel Version 21.4.0: Mon Feb 21 20:34:37 PST 2022; root:xnu-8020.101.4~2/RELEASE_X86_64 21.4.0
    Login status: logged in
    Catalyst license: supporter
    Insider build toggle: on
    Live preview: off
    Legacy editor: off
    Base theme: dark
    Community theme: ITS Theme
    Snippets enabled: 4
    Safe mode: off
    Plugins installed: 42
    Plugins enabled: 40
    1: Calendar
    2: Focus Mode
    3: Sidebar Expand on Hover
    4: Admonition
    5: Advanced Mobile Toolbar
    6: Dialogue
    7: File Explorer Note Count
    8: Recent Files
    9: Sort & Permute lines
    10: Tag Wrangler
    11: Add links to current note
    12: Show Current File Path
    13: Excalidraw
    14: Advanced Tables
    15: Ozan’s Image in Editor Plugin
    16: Footnote Shortcut
    17: Better footnote
    18: Kanban
    19: Dataview
    20: Advanced URI
    21: Metadata Extractor
    22: File Tree Alternative Plugin
    23: Customizable Page Header and Title Bar
    24: Block Reference Counter
    25: Gallery
    26: Mousewheel Image zoom
    27: QuickAdd
    28: Editor Syntax Highlight
    29: Obsidian Leaflet
    30: Tag Page Preview
    31: Annotator
    32: Spaced Repetition
    33: Collapse All
    34: Style Settings
    35: Note Refactor
    36: Outliner
    37: Image Toolkit
    38: Banners
    39: Convert url to preview (iframe)
    40: Citations

RECOMMENDATIONS:
Custom theme: for cosmetic issues, please first try updating your theme to latest. If still not fixed, please try to make the issue happen in the help vault or disable community theme and snippets.
Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the help vault or disable community plugins.


Hi.
Maybe this:

```dataview
TABLE
	image,
	price,
	purchase_date
FROM "MacBook" AND -#Mac/App
```
1 Like

Wow, thank you. It works!!