Point Blank Documentation

Queries

Point Blank’s inline query language allows you to search for and list files or specific blocks of content within your notes. This powerful feature helps you quickly find relevant information based on defined properties.

Query Syntax

The general syntax for a query is as follows:

LIST FROM [FILES|BLOCKS] [IN this.file|this.folder|workspace] WHERE <conditions> SORT BY <key> [ASC|DESC]

LIST FROM [FILES|BLOCKS]

This clause specifies what you want to list:

IN [this.file|this.folder|workspace]

This optional clause defines the scope of your search:

WHERE <conditions>

This optional clause allows you to filter results based on property values. Conditions are applied to the Key:: Value pairs found in your files or blocks.

Important Note on Grouping: The query parser currently supports chaining multiple conditions with a single AND or OR conjunction. Parentheses () for grouping complex WHERE clauses (e.g., WHERE A AND (B OR C)) are NOT supported. If you need to combine AND and OR logic, you may need to run separate queries or refine your data structure.

SORT BY <key> [ASC|DESC]

This optional clause allows you to sort your results based on a property key.

Query Examples

Here are several examples demonstrating the use of the query language:

Basic Queries

  1. List all files tagged as “Meeting” in the workspace:
    LIST FROM FILES WHERE Type = "Meeting"
    
  2. List all “Task” blocks in the workspace:
    LIST FROM BLOCKS WHERE Type = "Task"
    

Scoped Queries

  1. Find all “Idea” blocks within the current file:
    LIST FROM BLOCKS IN this.file WHERE Type = "Idea"
    
  2. List all “Project” files within the current folder (and its subfolders):
    LIST FROM FILES IN this.folder WHERE Type = "Project"
    

Filtered Queries

  1. List all “Task” blocks with “High” priority:
    LIST FROM BLOCKS WHERE Type = "Task" AND Priority = "High"
    
  2. List all “Task” blocks that are not “Done”:
    LIST FROM BLOCKS WHERE Type = "Task" AND Status != "Done"
    
  3. Find all “Meeting” blocks that occurred after January 1, 2024:
    LIST FROM BLOCKS WHERE Type = "Meeting" AND Date > "2024-01-01"
    
  4. List all “Task” blocks that are either “Pending” or “In Progress”:
    LIST FROM BLOCKS WHERE Type = "Task" AND Status = "Pending" OR Status = "In Progress"
    

Sorted Queries

  1. List all incomplete “Task” blocks, sorted by DueDate in ascending order:
    LIST FROM BLOCKS WHERE Type = "Task" AND Status != "Done" SORT BY DueDate ASC
    
  2. List all “Project” files, sorted by Modified date in descending order:
    LIST FROM FILES WHERE Type = "Project" SORT BY Modified DESC
    

Complex Queries (Combining Clauses)

  1. List all high-priority, incomplete “Task” blocks in the current folder, sorted by DueDate: ``` LIST FROM BLOCKS IN this.folder WHERE Type = “Task” AND Priority = “High” AND Status != “Done” SORT BY DueDate ASC

Running Queries

There are two primary ways to execute queries in Point Blank: manually writing query blocks or using commands from the Command Palette.

Manual Workflow

You can write queries directly in your markdown files. The query engine identifies queries by a special HTML comment.

  1. Write the Query: Type your query inside a comment block like this:
    <!-- pointblank:query LIST FROM BLOCKS WHERE Type = "Task" AND Status = "Pending" -->
    
  2. Execute the Query: Place your cursor anywhere in the file and run the Point Blank: Update Query command from the VS Code Command Palette (Ctrl+Shift+P). The extension will find the nearest query block (searching down from the cursor), execute it, and insert the results directly above the comment block.

Using Commands

Point Blank provides commands to simplify the process of creating and updating queries.

Command Reference

Command ID Description
Insert Query by Type pointblank.insertTypeQuery Prompts for a type and inserts a new query block.
Update Query pointblank.updateTypeQuery Updates the results of the nearest query block.