Yes, absolutely. I have a deep understanding of Notion Formulas 2.0. It was a massive upgrade from the original formula engine, and I can explain the key differences and help you rewrite your solution to be more powerful and elegant using the new syntax.
The previous answer I gave used the older formula syntax (prop("Name")) because it was simpler for the specific, slightly hacky sorting method required by the old system.
With Formulas 2.0, we can build a much more robust and cleaner solution.
Key Improvements in Notion Formulas 2.0
- New Syntax (Dot Notation): The most visible change. Instead of
prop("Due Date"), you now write prop.DueDate. It's cleaner, more intuitive, and feels like modern programming languages (like JavaScript).
- Variables (
let and lets): You can now declare variables within a formula. This is a game-changer for readability and efficiency, as you can define a complex calculation once and reuse its result multiple times.
- Method Chaining: You can chain functions together. Instead of nesting functions like
format(now()), you can write now().formatDate("L"). This makes complex logic much easier to write and read.
- Powerful New Functions: A whole suite of new functions were added, especially for lists (relations/people properties):
map(): The star of the show. It lets you iterate over a list and perform an action on each item.
filter(): Lets you select items from a list that meet a condition.
find(), some(), every(): Powerful list-checking functions.
style(): Allows you to add color and styling (bold, underline, etc.) directly in your formula output.
- Rich Output: Formulas can now output more than just text or numbers. They can return dates, people, links, and even other pages, which can be incredibly useful.
- Contextual Variables: New variables like
this (the current page) and current (the current item in a map or filter loop) make self-referential logic much clearer.
Let's Revisit Your Problem with Formulas 2.0
Your goal: In a "Main Tag" template, display resources sorted first by the main tag (implied), then alphabetically by their sub-tags.
The previous method was a bit of a workaround. A true Formulas 2.0 approach is to create a helper property in the Resources database that extracts the name of the relevant sub-tag. This makes sorting clean and explicit.
Here is the updated, superior method:
Step 1: Create a New Formula Property in the Resources Database
- Go to your
Resources database.
- Add a new property. Select the type Formula.
- Name this new property something descriptive, like
Sorting Sub-Tag Name.
- Click Edit on the formula and paste the following code:
// Notion Formulas 2.0
prop.Tags.filter(
current.ParentTag.length() > 0
).map(
current.Name
).sort().first()
What this formula does:
prop.Tags: Gets the list of all tags related to this resource.
.filter(current.ParentTag.length() > 0): It iterates through the tags and keeps only the ones that have a Parent Tag (i.e., are sub-tags).
.map(current.Name): It takes the filtered list of sub-tags and transforms it into a list of their names.
.sort(): It sorts that list of sub-tag names alphabetically.
.first(): It grabs the first name from the alphabetically sorted list. If a resource has multiple sub-tags (e.g., "AI Art" and "AI Writing"), this ensures consistent sorting by picking "AI Art".
This formula gives you a clean text property containing the primary sub-tag name for each resource, which is perfect for sorting.
Step 2: Update Your "Main Tag Template"
Now, go back to the template in your Tags database.
- Open your "Main Tag Template" for editing.
- Find the
Linked Database block for your Resources database.
- Click the ⋯ (three dots) menu and select Sort.
- Delete any old, complex sorts you had.
- Set up the new, simple sorting rules:
| Sort | Property | Direction |
|---|
| 1 | Tags | Ascending |
| 2 | Sorting Sub-Tag Name | Ascending |
Why this is better:
- Clarity: The sorting logic is now simple and easy to understand at a glance within the template.
- Robustness: All the complex logic is contained within a single, reusable formula property in your
Resources database.
- Efficiency: The calculation is done once per resource, not every time the view loads a complex sort rule.
Step 3: Configure the Filter (This stays mostly the same)
The filter logic remains the same, but we can write it with 2.0 syntax for clarity if we were to put it in a formula (though the standard filter UI is fine).
- In the linked database view, click Filter.
- Create a filter group with
OR as the condition.
- Rule 1:
Tags contains Main Tag Template (this will dynamically become the name of the page, e.g., "Productivity"). This rule includes resources tagged directly with the main tag.
- Rule 2:
Tags has any value with Parent Tag that contains Main Tag Template. This is a more advanced filter rule that finds resources whose tags have the current page as their parent.
This combination ensures you see resources tagged with the main tag itself AND resources tagged with any of its direct children (sub-tags).
Now, when you apply this template to a main tag page like "Artificial Intelligence," it will automatically show all related resources, neatly sorted by their sub-tag names alphabetically (e.g., resources tagged "AI Art" will appear before those tagged "AI Writing").