Formulas (Notion): verschil tussen versies

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen
Regel 1: Regel 1:
 +
An overview of Notion functions.
 +
 
== concat() ==
 
== concat() ==
  
Regel 8: Regel 10:
  
 
This probably isn't a very useful example, as it includes a label in the property field - Excellent way to mess up data integrity.
 
This probably isn't a very useful example, as it includes a label in the property field - Excellent way to mess up data integrity.
 +
 +
== format() ==
 +
 +
''Format'' is the oppositie of ''toNumber'': To convert something to a string. Example:
 +
 +
<pre>
 +
</pre>
 +
 +
== slice() ==
 +
 +
''slice'' is like ''mid$(string,positie,length)'' in some other languages
 +
 +
=== Syntaxis ===
 +
 +
<pre>
 +
slice(string, start-index [, end-index]) as string
 +
 +
* start-index: Starting at 0
 +
* end-index (option): Last character to include
 +
</pre>
 +
 +
=== Examples ===
 +
 +
[https://learn.thomasjfrank.com/notion-formula-reference/formula-components/functions/slice]:
 +
 +
<pre>
 +
slice("Dangerfield",0,6) // Output: Danger
 +
 +
slice("Monkey D. Luffy",0,6) // Output: Monkey
 +
 +
slice("Monkey D. Luffy", 10, 15) // Ouput: Luffy
 +
 +
slice("●●●●●●●●●●",0,6) + slice("○○○○○○○○○○",0,6) // Output: ●●●●●○○○○○
 +
</pre>
 +
 +
=== Sources ===
 +
 +
* https://learn.thomasjfrank.com/notion-formula-reference/formula-components/functions/slice
 +
  
 
== toNumber() ==
 
== toNumber() ==

Versie van 18 feb 2023 20:24

An overview of Notion functions.

concat()

Concatenate strings, including output from commands. E.g.:

concat("Created: ", formatDate(prop("Time - Created"), "W"))

This probably isn't a very useful example, as it includes a label in the property field - Excellent way to mess up data integrity.

format()

Format is the oppositie of toNumber: To convert something to a string. Example:


slice()

slice is like mid$(string,positie,length) in some other languages

Syntaxis

slice(string, start-index [, end-index]) as string

* start-index: Starting at 0
* end-index (option): Last character to include

Examples

[1]:

slice("Dangerfield",0,6) // Output: Danger

slice("Monkey D. Luffy",0,6) // Output: Monkey

slice("Monkey D. Luffy", 10, 15) // Ouput: Luffy

slice("●●●●●●●●●●",0,6) + slice("○○○○○○○○○○",0,6) // Output: ●●●●●○○○○○

Sources


toNumber()

You need toNumber() for calculations that involve relations: Eventhough the looked-up value might be a number, it isn't as it is a relation. Example:

toNumber(prop("Product unit price")) * prop("Number of products")

Also use this function to convert a date-/time field to Unix Epoch Time:

toNumber(prop("Created time"))

Sources