Getting Started with Blockpad

Back to previous page

Calculations In-Depth

Inside of a report, you can insert dynamic expressions. Each dynamic expression has a formula inside, where you will perform calculations, assign constants, and create functions. Regular text won't do these things. If you type in 2+2, nothing happens.

A dynamic expression looks like this:


The input section of an expression is highlighted in blue, and the calculated section is in purple.

Insert a Dynamic Expression

Dynamic expressions can be inserted using the [insert tool] or by typing the equals sign into the report.




If you want an equals sign, but not an expression, press esc after the expression opens. Also, the auto insert functionality for dynamic expressions can be turned off using the button in the toolbar.


Edit an Expression

To edit an expression, double click the highlighted area. You can also select the expression by moving over it with the arrow keys and pressing the spacebar.

Suggest Expressions

If there is an equals sign in the text that is not an expression, Blockpad will highlight the surrounding text in green to suggest it as an expression.

If you see this highlighted text, there are no calculations happening. If you want this text to calculate, right click the green highlighted area and select text to expression.

This functionality can be turned off or on using the button in the right of the toolbar.


Unit Tracking

Number values in Blockpad can have units.


Assign Units to a Number

To assign a unit, simply type the unit text after the number. The unit text must be the same as what is stored in the Blockpad library, but Blockpad will often autocorrect to what is intended. The dropdown selection will also help.


The calculation will track the units and convert along the way as necessary.


Convert a number to Different Units

To convert a value to a different unit, type "to" and the desired unit.


The end view hides the "to ft", but you see the result.


This will often need to be done at the end of a long calculation with many units, because the formula will not always cancel out units unless you ask it to.


Incompatible Units

If units are incompatible, the expression will calculate, but it will show a question mark as the unit and an error on the expression.


Values and Value Names

In Blockpad, formula results are always stored in the file as values. These values can be given names so that you can reference them in other formulas.


Values are created with calculations or just typing the value into the formula.


You can reference values with no name. Blockpad will create the name for you. If you try to reference a value using copy reference or click functionality (see "Referencing a Constant" below), then Blockpad will auto-assign a name to that value. In this case, 30 deg is value3 and 11 ft is value4.


Values inside of spreadsheet cells are a special case of this because you can reference the value in a cell using the cell reference (e.g B11 or AA4). In this case, the value doesn't need a name, it is referenced using it's location in the spreadsheet.

Values can also be text. To create a text value, be sure to use quotation marks (") or apostrophes (') to begin and end the text.


Values can also be matrices or complex numbers. See Vectors and Matrices and Complex Numbers.

Referencing a Value

There are three ways to use a value in a dynamic expression.

  • With a formula open, click on the formula where the value is defined, just like clicking on a cell in a spreadsheet.
  • Before opening a formula, go to where the value is defined, right click and select "Copy Reference". Then open a different formula and paste.
  • Type the name into the formula. The dropdown will help you out. A location in front of the name with dot notation may be needed if the value is stored in a different frame but clicking and copy reference can always be used when in doubt. See "Frames" for more information about value containers.
Constant Names

There are a few good things to know about creating value names.

  • Names are a combination of text, numbers and some kinds of symbols.
  • Numbers cannot be the first part of a name.
  • Allowed symbols are underscore (_), dollar sign ($), pound symbol (#), at symbol (@), and question mark (?).
  • Spaces are allowed.
  • Names are case sensitive, but Blockpad will often auto-correct to the correct case if there isn't another name with the same spelling but different case.
  • It is best practice to avoid spreadsheet cell names, e.g. A5, D150, or BR559, although this is allowed in a report frame. It is not allowed in a spreadsheet frame, because cell references can be used to reference the values inside of them.
Double Names

If the same name is used more than once in a frame, then Blockpad will show an error if that name is referenced anywhere.


If a value is renamed, then all references to that value will update to show the new name. The reference won't be broken.

Built In Values

There are a few built-in number values: pi, e, and i


Properties and Showing Parts of Expressions

You can use the properties window to show and hide different parts of a dynamic expression.

You can show and hide

  • the value name
  • the calculation
  • the result
  • the steps (shows values plugged in, not order of operations)

You can also choose to view the expression as multiple lines and turn the math layout off.

To do so, open the properties window (Edit->Properties, or right click -> Properties, or press f4), select the expression, scroll to the bottom of the window, and under Formula, toggle what you want to show or hide.



In Blockpad, you can use functions inside of formulas, just like in a spreadsheet cell. There are a lot of built in functions, but it is also easy to make your own functions, which we'll go over later in this section.

There are basic math functions.


There are also logical functions.


The expression above uses the if() function. When you edit it, it looks like an if function in a spreadsheet.


A quick note on logical functions: to test if something is equal, a double equals sign is used. This is to distinguish testing equality from assigning value names and performing calculations.

Some functions are only used with tables and spreadsheets, like lookup functions.

Functions will track units.


There is an error in the last example because units are incompatible

And functions that require angles are unit sensitive.


Define a Function

Defining a function in Blockpad is simple and a very powerful way to limit rework.

To define a function, you specify the function name, the function variables, and the calculation. These are defined in a specific way. Let's look at the sample below


Here, "hypotenuse" is the function name, "a" and "b" are the function variables, and Sqrt(a^2+b^2) is the calculation. Now hypotenuse() is defined as a function and can be used in calculations.


Here are the basic steps to writing a function:

  1. Open a formula.
  2. Type in the function name.
  3. Type in open and closed parentheses.
  4. Inside of the parentheses, type in the function variables.
    1. Variables are separated by a comma.
    2. Variables are in the order that you will select them when using the function later.
  5. Type in an equals sign.
  6. Type in the function calculation like any other calculation but using the function variables where you want them.
  7. image052

    Using a defined function is very similar to referencing a value: clicking, copy reference, or typing the name in all work. Then you proceed like a normal built-in function, with parentheses and typing in values for the function variables.


    A few things to keep in mind:

    • Function names and function variable names follow the same rules as names for values (can't start with a number, only certain symbols are allowed, etc.).
    • The order that function variables are put into the function definition is the order that they are selected when using the function later.
    • Function variable names are local to the function. So, you can use that same name for a value outside of the function, and it won't relate in any way to the function.
    • Functions are stored in Blockpad very similarly to values (functions are actually considered to be "values"). So, referencing values and using a defined function are very much alike.

    Arrays, Vectors, and Matrices

    Blockpad formulas also support arrays, vectors, and matrices. Many of the built-in functions are matrix compatible as well.


    In Blockpad, these "matrices" are called arrays. Arrays, can have any type of values: text, numbers, even more arrays.


    When doing numerical calculations, a 1-dimensional array with only numbers is called a vector, and a 2-dimensional array with only numbers is called a matrix.

    To create an array in a formula, brackets are used. Brackets [ ] specify the start and end of the array. commas (,) separate members of one row into columns, and semi-colons (;) specify the end of a row. For example, [11, 22, 33; 22, 33, 11; 33, 11, 22] typed into a formula produces the matrix below.


    Arrays can also be created by referencing a group of cells from a spreadsheet or table. In this case, the array will update with the table.


    Array values can have names, just like normal number and text values.


    And matrix calculations can be performed just like regular calculations.


    If a matrix calculation can't be completed, then you will get an error.


    And of course, matrices support number values with units.


    And unit tracking.


    Functions work with arrays too. Some treat the array like a list or a group of spreadsheet cells.


    And some treat the array as a matrix.


    You can also reference an array for lookup functions.


    Complex Numbers

    Blockpad supports complex numbers in a very simple way. Simply use the letter i to denote the imaginary number inside of a dynamic expression. The square root of a negative number will also produce i.


    Continue to next page