Documentation: Are parenthesis able to group logical operators?
See original GitHub issuePlease provide a link to the documentation page and section
https://blacksmithgu.github.io/obsidian-dataview/api/code-reference/#dvpagessource
Describe the problem
- The documentation doesn’t say whether parenthesis are a valid way to group logical operators.
- For example, I’d like to do
dv.pages('"dir" and (#tag1 or #tag2)')
to find all documents in “dir/” that contain EITHER tag1 OR tag2. Documents must only match from the “dir” folder. Initial testing seems to confirm that this works, but it’s not documented anywhere. - Another example query is
dv.pages('"dir" and (#tag1 and #tag2)')
to find all documents in “dir/” that contain BOTH tag1 AND tag2. - If both of those queries are legal/valid, what about something even more complex, such as this?
dv.pages('"dir" and (#tag1 and (#tag2 or #tag3))')
- Is that valid? - What about groups with just one operand, like this?
dv.pages('"dir" and (#tag1) and (#tag2)')
- is this valid?
Describe the solution you’d like
- Can you confirm whether the syntax I just described is legal/safe to use?
- If so, it would be very useful to document it on the
dv.pages()
API page among the other examples listed there. 😃
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Grouping operator ( ) - JavaScript - MDN Web Docs
The grouping operator consists of a pair of parentheses around an expression that groups the contents. The operator overrides the normal ...
Read more >Should I fully parenthesize expressions or rely on precedence ...
Good developers strive to write code that is clear and correct. Parentheses in conditionals, even if they are not strictly required, help with...
Read more >powershell - Using parenthesis for multiple logical operations
The logical AND operator -and converts the values designated by its operands to bool, ... So this determines the rules for adding (or...
Read more >Search Operators | GovInfo
Parentheses are used to group words and expressions so that the result of evaluating the expression between the parentheses can be used as...
Read more >Rule operators and grouping symbols - Cloudflare Docs
The Cloudflare Rules language supports comparison and logical operators: ... Use parentheses to explicitly group expressions that should be ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, arbitrary nesting is fine - Dataview uses a parser combinator library which supports LL(infinity) grammars, including all the standard things you expect out of an expression parser like in JavaScript.
Fixed in documentation; will show up during the 0.5.38 release later.