Overview
Problem Description
For data entry templates, the problem is how to set the value of cells in the newly inserted row or column to be null, a custom value, or the value inherited from the previous cell.
Implementation Method
You can set the row insertion policy for cells. The policy provides three options: Null, Default, and Original, as shown in the following figure.
The following content describes the three policies.
Null: The value of cells in the newly inserted row or column is null. (The system defaults to this option.)
Default: You can enter a custom value (a formula is also allowed). When you insert a row or column, the cells will be automatically filled with this value.
Original: New cells will inherit the content of the original cells. This is generally applicable to cells defined by formulas, which will be preserved when you insert a row or column.
Example
Report Design
1. Create a database query dataset named ds1 and enter the SQL statement SELECT * FROM Sales.
2. Design the data entry table. Insert text widgets into cells A3 and B3, insert number widgets into cells C3, D3, and E3, and insert the formula C3-D3-E3 into cell F3, as shown in the following figure.
3. Add a button widget to cell G3, set Button Type to Insert Row, set Specified Cell to A3, and set Number of Rows to 1, as shown in the following figure.
Setting Method
This section introduces the three policies and demonstrates the actual effects of each policy.
Null Value
Null is the default option, which means each time a new row is inserted, the cells in the row are blank. Set the row insertion policies of the cells where the fields ID, Sales Volume, Sales Cost, and Other Expenses are located to null values, as shown in the following figure.
Default Value
The option Default means you can define the content of cells in the to-be-added row through data types (String, Integer, Double, Date, Boolean, or Formula), as shown in the following figure.
Set the default value of the cell where the field Region is located to the string and enter North America in the input box, as shown in the following figure.
Original Value
Set the row insertion policy of the cell where the field Revenue is located to the original value to make the to-be-added cells inherit the original formula, as shown in the following figure.
Effect Display
PC
Save the template and click Data Entry Preview. The following figure shows the effect.
Mobile Terminal
Template Download
You can download the template: Row Insertion Policy.cpt.