Connect Notes With The Relation Property
The image above is a list of pages in an example database (link below article to take a look). This list of concepts are pizza-themed. We’re going to connect these pages in a hierarchical fashion with “Pizza” as the “Top” note and all below it are notes that describe pizza. We want the connections to look like this:
Pizza
Pizza Dough
Pizza Sauce
Pizza Toppings
Pepperoni
Cheese
Sausage
Pineapple
Spinach
Create a relation property inside your database. A list of databases to choose from will be available upon creating a relation. Choose to connect your notes database to itself.
The relation property acts as a connector between two or more pages in your workspace. Pages can be connected between different databases or between pages in the same database.
In the image above, you’ll notice a second text field labeled “Parent.” This second field prompts you to name the backlink relation that you can choose to include.
For example, I can create a relation that connects all “subordinate” descriptions to a single concept. The backlink relation will ensure I can auto-fill the concept “parent” relation when inside of a description page. This circular connection is also illustrated in the preview box upon editing a relation property.
All “Subordinate” notes can now be connected to a “Parent” note’s page. This is useful for simplifying complicated concepts.
How To Isolate All Top-Tier Notes
Create a new database view via the “+” button on the top bar of any database.
The pizza page is the only page in this example that does not contain a “Parent” page. However, it does contain three “Subordinate” pages. To classify pages like Pizza as “Top Tier,” I need to create a rule that states: Page’s Parent is empty and page’s Subordinate is not empty. This rule can be declared with a filter that looks like this:
Label Relationships With Formula
Returning to the original page hierarchy for our pizza notes, there is one subordinate page for pizza called “Pizza Toppings” that also has subordinate pages of its own. In this case, I want to create a small label for “Pizza Toppings” page that declares how many subordinate pages it has like this:
With this formulaic label, we can preview what subordinate pages of any given page are either “dead-ends” or have further content, or subordinate descriptions, to explore.
Firstly, a rollup property should be created to count the number of entries inside the “Subordinate” relation property. Rollups are useful for communicating with relations to calculate or aggregate information associated with connected pages. I named the rollup “No. Desc” for number of descriptions. This is how the rollup should be configured:
relation = Subordinate, property = Subordinate, calculate = Count all
Next, create a formula property. The only prerequisite for this formula to work is there must be a rollup named “No. Desc.” This property can be renamed after the formula code is pasted into the database. Here is the code:
if(prop("No. Desc") > 0, format(prop("No. Desc")) + " desc ▶︎", "")
This code will display the number of subordinate pages the current page has in addition to a toggle symbol. Here is a brief breakdown of the formula:
if(prop("No. Desc") > 0,: If the property labeled “No. Desc” is greater than 0,
format(prop("No. Desc")): convert the number inside “No. Desc” into text,
+ " desc ▶︎",: and add a text string to the end of the formatted number.
""): false condition: If the property labeled “No. Desc” is not greater than 0, leave an empty space.
Show Relationship Label In Relation Property
Locate any page with subordinate pages. Inside the relation property, select the “+” button next to any page.
Inside this menu, there is an option to view any properties related to the connected pages. In this case, I want to see my label formula next to each page.
Database View For Orphan Pages
Where do pages go that have no parent and no subordinates? This page is called an orphan. We can create a separate database view for these notes. Again, to create a new database view, select the “+” button at the top of the database.
This database view will have the opposite filter rules from “Top” that states: Page’s Parent is empty and page’s Subordinate is empty. In the template available to duplicate below, I converted this view into a ‘List view’ (available to modify inside Layout in the database menu).