Basics of Using Formulas
By setting a formula in an app, you can calculate the sum of multiple values or have a value automatically displayed according to conditions specified in a function.
This page describes the basics of using and setting up formulas.
Formula basics
It is necessary to understand the following three points when using formulas.
Formulas are entered on the settings screens of "Calculated" and "Text" fields
Formulas can be used only with "Calculated" and "Text" fields.
Use a "Calculated" field if you want the calculation result to be treated as a numeric value, or use a "Text" field if you want the result to be treated as a string value.
Field codes are used to refer to fields in a formula
A field code is a string used for identifying a field. In formulas, field codes are used to refer to other fields.
For details, refer to the following pages.
Overview of Field Codes
Fields That Can/Cannot Be Referenced in Formulas
Clicking Insert Field Code displays a list of the field codes that exist in the app you are using.
Select a field code from the list to have it entered in the Formula input field.
Formulas use functions and operators
Formulas in kintone support half-width operators (e.g., "+", "-", "*", "/"), as well as functions.
You can use multiple operators and functions together in a single formula.
List of Operators and Functions
Clicking Insert Function displays a list of the functions you can use in kintone.
Select a function from the list to have it entered in the Formula input field.
How to set formulas
As an example, this section walks you through setting up a formula that multiplies a unit price and quantity to produce a subtotal.
You will use "Number" fields for entering numeric values, and a "Calculated" field for displaying the calculation result.
-
Click the App Settings icon (the gear-shaped icon) at the upper right of the "View" screen.
-
On the "App Settings" screen, click the Form tab.
-
Place two "Number" fields on the app form by dragging the "Number" field displayed in the list of fields on the left side of the screen and then dropping it onto the area on the right side of the screen.
-
Open the settings screen of the "Number" field that will be used for entering a unit price. To do so, click the Settings icon (the gear-shaped icon) at the upper right of the "Number" field, then click Settings.
-
Enter "Unit price" in the Name input field.
-
Enter "Unit_price" in the Field Code input field.
-
Click Save.
-
Open the settings screen of the "Number" field that will be used for entering a quantity. To do so, click the Settings icon (the gear-shaped icon) at the upper right of the "Number" field, then click Settings.
-
Enter "Quantity" in the Name input field.
-
Enter "Quantity" in the Field Code input field.
-
Click Save.
-
Place a "Calculated" field on the app form.
-
Open the settings screen of the "Calculated" field. From the Settings icon (the gear-shaped icon) at the upper right of the "Calculated" field, click Settings.
-
Enter "Subtotal" in the Name input field.
-
Enter the following formula in the Formula input field.
Unit_price*Quantity
-
Click Save.
-
Click Save Form on the upper left side of the screen.
-
If you are creating a new app, click Activate App at the upper right of the screen and click OK on the confirmation dialog.
If you are changing the settings of an existing app, click Update App at the upper right of the screen and click Update App on the confirmation dialog.
Now you have completed setting the formula.
When you enter a unit price and quantity on the "New Record" or "Edit Record" screen, the calculation result will appear in the "Subtotal" field.
If an error message appears
If an error message appears when setting a formula or entering data on a record, refer to the following pages for solutions.