<aside> đŸ’¡ Key concepts in this tutorial: Sheet defined function; barriers; table comprehension.
</aside>
We have introduced the use of single-page forms and multi-page forms. Now let’s look at the use of sheet defined functions which are a key feature of Planarly.
This tutorial will introduce:
Scenario setting: According to government regulations, residents can reduce or exempt the taxable amount of personal income based under the following circumstances:
As a tax consultant, you need to help customers calculate the amount of tax payable and file tax returns. You can follow this tutorial using the Personal Income Tax sheet.
For the first step, we will create the sheet tax
, as shown below. We are going to use it to create what Planarly calls a sheet function.
A sheet function is how you create re-usable functions in Planarly. It combines sheets, cell labels, and a few naming conventions to allow you to create and document powerful functions that you can call from anywhere in your document.
When you create a sheet function, the name of the sheet is used as the function name. This means you can only have one function per sheet. But there is no limit to how many sheets you can create.
You probably want your function to accept a few parameters to perform its calculations on. In the sheet function, you define positional parameters by giving cells label names of the form X + number
: X0, X1, X2, etc
. The numbers have to be continuous. In the image above you can see the Xn
labels in the upper cells.
Note the two label names X2
and ZX2
. This combines the X
prefix for parameter names with the Z
prefix for table boundaries that was covered in the Single Sheet tutorial.