{{ }} expressions to add up and count

{{ }} expressions to add up and count

#65Idea

I often list small numbers in an outline and add them up. Right now I calculate in Spotlight and paste the result. It would be faster to calculate in the outline.

The idea

Write {{ sum }} in a row. It shows the total of the numbers in the rows below. You don't need tags or special fields. Just write numbers as usual.

You write:

Trip budget {{ sum }}
  Flights 420
  Hotel 180
  Food 120

You see:

Trip budget 720
  Flights 420
  Hotel 180
  Food 120

The total updates when you change a number or add a row.

{{ sum }} could also add up more than plain numbers, like time:

You write:

Writing log {{ sum }}
  Draft 3:30
  Edit 4:00

You see:

Writing log 7:30
  Draft 3:30
  Edit 4:00

{{ words }} works the same way. It shows the word count, so you can see how long each part of a draft is:

You write:

Essay draft {{ words }}
  Intro {{ words }}
    ...
  Part 1 {{ words }}
    ...

You see:

Essay draft 1,240
  Intro 310
    ...
  Part 1 930
    ...

A plain number may not say what it counts. If you want a label, write {{ words= }} instead:

Essay draft words=1,240
  Intro words=310
    ...
  Part 1 words=930
    ...

In the app, words would appear as a small label, so the number is easy to see.

Other ideas:

  • {{ 1200 * 12 }}: simple math
  • {{ chars }}: character count
  • {{ count }}: number of rows
  • {{ progress }}: how many checkboxes are done

Choosing the range

{{ sum }} is short for {{ descendants.sum }}. The first part says which rows to use:

  • descendants: all rows nested under it (default)
  • children: only the rows one level down
  • siblings: other rows at the same level
  • parent: the row one level up

You write:

Trip budget 1000
  Flights 420
  Hotel 180
  Left {{ parent.number - siblings.sum }}

You see:

Trip budget 1000
  Flights 420
  Hotel 180
  Left 400

parent is one row, so parent.number is just its number, 1000.

Autocomplete

These names are hard to remember, so good autocomplete is important:

  • Suggestions when you type {{
  • A preview of the result before you pick
  • Clear messages when something is wrong

Export

When you export, you could choose to export the results instead of the {{ }} expressions.


This may be useful only for some people. But I think it fits Kosshi's design well, and it could make the outliner a better thinking tool. I made a simple prototype before, and the basic idea seems possible. For now, other things come first, such as improving the basics.

I posted the Summaries idea before. But showing summaries on every collapsed row can make the screen too busy. So I'm thinking of this instead. With {{ }}, you can put summary-like information only where you want it.

this is a brilliant and novel idea, Junichi! I would love such a feature.

Delete post

The post body and edit history will be removed. A quiet marker remains only when visible replies link to this post.

Open original