Calculations

Tables

Mini-spreadsheets

Blockpad supports tables that act like mini-spreadsheets inside of a document. You can use normal Blockpad formulas in the table, and reference values back and forth between the table and report.

Insert a mini-spreadsheet table:
  1. While in a document, click the Insert Table button in the toolbar.
  2. Click OK.

You can use all of the Blockpad formula features inside of a table, including units, naming values, and creating functions.

To reference values in the table, you can use clicking like in a spreadsheet or any other referencing method. Notice the table name appears in front of the value. This is because a table is a frame that contains values.

You can change a table's name so that a useful name appears in the formula.

  1. Select the table by clicking on the label.
  2. Open the properties window.
  3. Under Object, click Name.
  4. Type in the new name.
  5. Press enter.

Referencing works both ways. You can reference document values from inside a table too.

Multiline cells

You can also have a word processor style table cell, called a multiline cell. Multiline cells act a lot like a document, so you can do all the same things, like format text, equations with math notation, and more.

Change a cell to multiline:
  1. Select the cell or cells.
  2. In the toolbar, change Value Cell to Multiline.

(To change a cell width, you can use the properties window or show rulers (View>Show Rulers) and drag the borders of the ruler.)

A multiline cell is considered to be a frame, like a table. You don't need to specify the name in front of references because capture values is set to no by default.

Word processor tables

In a report, you may often want all of the cells in a table to be multiline. Do this automatically by selecting word processing mode when you insert a table.

Insert a word processor style table:
  1. While in a document, click the Insert Table button in the toolbar.
  2. In the window that appears, change Mode to Word Processing Mode.
  3. Click OK.

Fields

Fields act like spreadsheet cells, but in a document. You can have formulas in them like a dynamic equation, but the formatting is more similar to a spreadsheet cell.

For example, fields will hide any formula inside by default, just like a spreadsheet cell.

Inline fields

Fields are a set width by default. While you can manually change the width in the properties window, the field will not adjust to the content inside.

However, you can change this behavior by changing the field type to "inline". When changed to inline, the field will fit the size of the text or value inside.

Dropdown lists

You can use fields to make a dropdown list so that people using the document can only choose from a pre-set list of options.

Create a dropdown list in a report:
  1. Insert a field using the field button in the toolbar or the insert button.
  2. Select the field and open the properties window.
  3. If desired, name the field by editing the Name property.
    • This is the name that will be used in calculations.
  4. In the properties window, select the Value Definition property, near the bottom under Style.
  5. In the window that appears, select From Option List in the dropdown.
  6. Enter a formula that results in an array.
    • The items in that array will be the the dropdown list options.
    • You can type in an array directly, reference a named array, or reference a group of cells.
    • Often it's best to create an array in the document, and then reference it in this window.
  7. Click OK.

You can also follow the steps above to create a dropdown list in a spreadsheet cell.

Built-in functions

In Blockpad, you can use functions inside of formulas/dynamic equations, just like in a spreadsheet. There are a lot of built in functions, but it's also easy to make your own custom functions, which is covered farther down.

Below is a basic intro to Blockpad built-in functions. For something more in-depth, see the functions section of the deep dive.

Blockpad functions are made to match conventional spreadsheet functions. So Blockpad includes most basic math functions like Sum(), Sqrt(), Abs(), and Average().

However, unlike conventional spreadsheets, Blockpad functions are made to work with units intelligence.

Trig functions are a noteable example of this. You can give the inputs in degrees or radians, and the result will reflect that.

Blockpad also includes most other kinds of functions found in spreadsheets and more, including text functions, logic functions, lookup functions, calculus functions, and numerical solving functions.

Custom functions

Custom functions are simple and accessible in Blockpad - you can create them in a normal formula and use them throughout a document.

You can also save functions to a library and use them in different files or share them with colleagues.

Defining custom functions

To define a function, specify the function name, the function variables, and the calculation. Let's look at the sample below.

In the first dynamic equation, "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 you can use it in calculations. In the second equation, hypotenuse is used as a function and calculates the inputs 3 ft and 5 ft.

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

You can also think of making a function in terms of calculating a value.

First, write out the formula as if you were calculating a single value. Then, replace change the value or values in the formula to parameters by renaming them and putting them in parentheses after the name.

Using custom functions

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

Named values in function definitions

You can use named values and spreadsheet cells in the document as part of a function definition, just make sure the names don't conflict with the parameter names.

In the example below, the density value is part of the function. If you change the density, then it changes the function and thus the output as well.

Layering custom functions

You can also use your own defined functions inside of a custom function.

This makes sense to do if a function you're writing starts to get too long. You can write part of it in one function, then use that function in the final one.

A few things to remember:
  • Function names and function variable names follow the same rules as value names (can't start with a number, etc.).
  • 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 similar.
In-line functions

There is another way to define a function, without giving it a name.

To do so, type the function variables in parentheses, an equals sign with a greater than sign, and then the calculation. To use this function, you can use copy reference or clicking and Blockpad will auto-generate a name. For single variable functions, the parentheses can be dropped.

You can define functions like this in a spreadsheet cell, and then reference the cell to use the function. Using a function like this can feel a little funny. It's not particularly recommended, but it's mentioned here for understanding.

You can also name functions while defining them like this. Just type the name and equals sign before the in-line function, like you are naming a value.

Equation solving

Solver sections

Solver sections make solving systems of equations straight forward. Check out the video on solver sections or learn more in sections.

Insert a solver section:
  • Select the solver button in the toolbar.

To use a solver section, type in dynamic equations that use new variables. You can reference already named values like normal. When there's enough information to solve for the variables, the answers appear at the bottom. You can reference these answers the same way you reference other values in a document.

That's enough to get started with calculations

Feel free to move on to spreadsheets, or continue to learn more calculation features.

 

Table of Contents