Skip to main content

Set Default Value - Function Calculation


Like the functions in Excel, HAP provides a variety of functions for processing data. After setting a formula for a field in a worksheet, the value of the field can be obtained automatically when creating or modifying a record. There is no need to fill in the field manually, improving efficiency.

In the following two scenarios, you can rely on functions to process the data.

  • Set the default value for the field.

  • Calculation nodes in a workflow.

There are five types of functions, which are math function, date function, text function, logical function and advanced function.

Use Case

1. Use the logical function to derive the corresponding results

If the value of a field follows the change of other fields, the logical function can be selected.

2s. Use the text function to identify the birth date in the ID number

Use the text function to get the birth year, month and day in the ID number and combine them into a date format.

Function Configuration

Default values of the following fields can be set by the function: Text, Number, Amount, Date, Email, Telephone

Fields that can be used as parameters of the function: Text, Number, Amount, Email, Telephone, Date, Single-select, Multiple-select, Members, Department, Check items, Region/City, ID Number, Subform

  • Fields that cannot be used as parameters: Level, Concat, Foreign, Formula, Rollup, Auto-number, Rich Text, Cascading, File, Uppercase, Signature

Entrance to Configuration: On the form editing page, select the target field, go to [Default value] > [Use Dynamic Value] > [Function Calculation].

Select the target function and field from the left, or edit the function and static parameters manually.

Composition of Function

A function formula generally consists of a function name, parameters, operation symbols, and parameter separators.

As shown in the function below, the parameters can be either field values or static values.

In practice, a function may not involve all of the above elements, or you can nest multiple functions.

Rules for Editing Functions

1. No equal sign [=] at the beginning of the function

2. Select the proper function and field parameters

  • You can choose the desired function from the left, or you can type it manually, all in uppercase.

  • Fields must be selected from the left.

3. Select the proper function type

The result returned by each function belongs to some fixed type. Therefore, when setting a default value for a field, you must select a function that is consistent with the field type.

For example, when you want to set a default value for a numeber field, if you select [DATENOW()], which returns the date, there will be no content.

4. Write operation symbols correctly

Add+
Subtract-
Multiply*
Divide/
Greater than
Equal to==
Less than
Greater than or equal to>=
Less than or equal to<=
Not equal to!=

5. Write parameters correctly

For example, for the SUM function, the parameter must be a number field, if you select a date field, the result cannot be returned.

Most functions require parameters. Parameters can be static values, dynamic values, or a combination of the two. You must ensure the correct writing of parameters.

1). Static Parameters

A static parameter refers to the parameter that is written as a fixed value, using the same value for each calculation.

  • Static parameters of text, and time fields must be enclosed in single quotes at the beginning and end.

    Text, time, and single-select fields are all of text type, and if the parameter is a fixed value, the content must be enclosed in English quotes at the beginning and end (double quotes are also acceptable).

    Example 1: Get the day of December 31th, 2022.

    Example 2: Replace the 4-7 digits in the phone number with *. It is a fixed parameter with single quotation marks at the beginning and end.

  • For static parameters of number field, write numbers directly.

    Example 3: When getting the mobile phone number, you need to specify which digit to start with, and you can write 4 directly without quotation marks.

2). Dynamic Parameters

  • If the parameter is the value of the field, you can select it directly without quotation marks.

    Example 1: If you want an approximate value of a decimal, select the field directly.

    Example 2: If you want the sum of multiple fields, select the corresponding fields and add a separator (English comma) between the parameters.

  • If the parameter is the result returned by another function, there are no quotation marks at the beginning and end.

    Example 3: Get the day of the current date.

3). Combination of static parameters and dynamic parameters

If the parameter is a combination of dynamic and static parameters, the combination is of text type, so no quotation marks are required.

Introduction to 50 Functions


Have questions about this article? Send us feedback