Using constants in Go Calc

One of the many powerful features available in Go Calc is user defined constants. When you are writing a formula you can refer to a variable or result in another calculation. One way you can use this is by defining commonly used constants. In this post I will show you how to define a constant for VAT (Value Added Tax, called Sales Tax in the US).

Here is a Go Calc freshly purchased from the App Store:

Go Calc just installed

I am going to create a category (folder) to store my constants in. Simply tap the Edit button and choose New Category. I will name the category Constants.

Creating a new category 1Creating a new category 2Creating a new category 3

Tap on the newly created Constants category and tap the Add (+) button to create a new calculation. This calculation will store the financial constants.

Empty CategoryNew Calculation Finance

Click Save to start editing the calculation. In this example just one constant is going to be added. Tap the Add Variable button and we will add the VAT constant.

Editing the Calculation

The variable name is VAT, a suffix % is added and two decimal places are to be shown.

New Variable VAT

Tap Save. You can now set the current VAT rate – double tap on the VAT variable (or tap the blue indicator)

Showing the VAT variableSetting the VAT valueThe set variable

I will now create a new calculation which will use this constant.

Creating the example calculation

The calculation has a variable Price Exc VAT

*Variable Price Exc VAT

… and then add a result which will work out Price Inc VAT. The formula refers to the constant defined earlier. To refer to a constant you need to describe the path needed to reach it. In this case the constant is in the Finance calculation, which is filed in the Constants category. So we write Constants.Finance.VAT (..). Using this technique you can refer to any variable in any calculation you have in Go Calc.

New Result 1The formula

Here is the example calculation in use.

The example calculation

Now if VAT changes you can change the constant and any calculation using it will automatically have the up-to-date value.

Happy Go Calc-ing!