I. Overview
1.1 Problem
When making a report, sometimes it is necessary to directly obtain the number in the string, as shown in the following figure:
1.2 Solution
This can be realized by adding JS click event to the button.
Note: This function does not support mobile devices.
II. Example
2.1 Report Design
Create a new built-in dataset Embedded1, as shown in the following figure:
Design the table as shown below, add [Button Widget] to cell B2.
2.2 JS event
Select cell B2, click the [Event] tab, and add a [Click] event to the button widget.
Add parameter A, select the type of Value [formula], and enter A2.
Add the following JS:
var num= A.replace(/[^0-9]/ig,"");
var location = this.options.location;
var cr = FR.cellStr2ColumnRow(location);
var col = cr.col;
var ro = cr.row;
contentPane.setCellValue(1,ro,num);
2.3 Preview effect
Save the report, click [Data Entry Preview], and click the button to get the numbers in the other string.