Overview
Version
Report Server Version | Functional Change |
---|---|
V11.0.9 | Added the Global Search and Replacement function. |
11.0.10 | 1. Added Set Item to Global Search and Replacement. 2. Added a legality check before the replacement of the component and widget content. |
Application Scenario
In the daily development of reports, you may have difficulty finding and replacing content due to the large number of reports developed. For example, it is difficult to locate a cell and to know which dataset a certain SQL statement is applied to. FineReport has added the Global Search and Replacement function, which can help you easily find and locate text content in a single template, and achieve global content replacement for a single template.
Function Description
1. Range of application: CPT, CPTX, and FRM.
2. Template Content that can be searched and replaced includes cells, JS events, floating elements, SQL statements, components, widgets, and formulas.
Search Range | Search Content | Return Value |
---|---|---|
Cell | The cell content (refers to cells in general reports and cells in report blocks of dashboards) | Search Content (highlights matching words), Template Name, the sheet, Distribution Component, Location Info, and Operation |
JS Events | The JS events | Search Content (highlights matching words), Template Name, Location Info, and Operations. |
SQL | The SQL events | Search Content (highlights matching words), Template Name, Data Connection Name, Dataset Name, Location Info, and Operations. |
Floating Element | The content and title of the floating elements | Search Content (highlights matching words), Template Name, the sheet, Distribution Component, Location Info, and Operation. |
Component | The component name | Search Content (highlights matching words), Template Name, the sheet, Distribution Component, Location Info, and Operation. |
Widget | The name and watermark of widget | Search Content (highlights matching words), Template Name, the sheet, Distribution Component, Location Info, and Operation. |
Formula | The formula | Search Content (highlights matching words), Template Name, the sheet, Distribution Component, Location Info, and Operation. |
3. When you replace the content of a component or widget, if the replacement content is null or duplicated, a prompt "Do you want to perform legality check?" will be displayed, as shown in the following figure.
· Check: Perform a legality check on the replaced content. If it is legal, a prompt "No risk item is found." will be displayed; if it is illegal, a prompt "It is found that risks exist after you replace the following {} content(s) (which may cause the template to be unavailable.) You are advised to perform manual modification or do not perform replacement." will be displayed.
· Directly Replace: Replace the content without a legality check.
4. Template Content supports the use of wildcards for search and replace.
Wildcard | Definition |
---|---|
# | Any single digit |
$ | Any English letter |
? | Any single character |
5. Searching and replacing in Set Item mainly includes two parts, as shown in the following table.
Search Range | Search Content | Return Value | |
---|---|---|---|
Cell setting | Cell-Format
| Common, Number, Money, Percentage, Permillage, Scientific Count, Date, Time, and Text | Search Content (highlights matching words), Template Name, the sheet, Distribution Component, Location Info, and Operation |
Cell-Data Setting | Group > Common, Group > Adjacent, List, Summary > Sum, Summary > Average, Summary > Max, Summary > Min, Summary > Count, Summary > None | Search Content (highlights matching words), Template Name, the sheet, Distribution Component, Location Info, and Operation | |
Cell-Data Column | Dataset Name-Data Column Name | Dataset Name-Data Column Name | |
Data Source Setting Note: 1. Only display the list of authorized items. 2. Replacement operations are not supported. | Data Source-Data Connection | Data connection list | Search Content (highlights matching words), Template Name, and Operation |
Data Source-Dataset | Template dataset-dataset list and server dataset-dataset list | Search Content (highlights matching words), Data Connection, Template Name, and Operation |
General Report
Data Content
Open the report in the path %FR_HOME%\webroot\WEB-INF\reportlets\GettingStartedEN.cpt.
1. Choose Template > Global Search and Replacement in the menu bar to bring up the Global Search and Replacement dialog box. Select Cell from the drop-down list in Search Element under Template Content, as shown in the following figure.
2. Set Search Range to Current Template (the default option), enter Region in the drop-down box for the search content, and click Search to locate the sheet and position information of the cell in the current template that contains the Region text, as shown in the following figure.
3. Click Location to locate the specified content in the current template, as shown in the following figure.
4. Enter City in the drop-down box for replacement, and click Replace. As a result, the Region texts in the current template are replaced with City, as shown in the following figure.
5. Click Save to save the replaced content and click Preview, as shown in the following figure.
Set Item
Take searching and replacing Cell-Data Column as an example. Open the report in the path %FR_HOME%\webroot\WEB-INF\reportlets\GettingStartedEN.cpt.
1. Choose Template > Global Search and Replacement in the menu bar to bring up the Global Search and Replacement dialog box. Select Setting Item, as shown in the following figure.
2. Select Cell-Data Column in Search Element and Current Template in Search Range. The search content is ds1 > Product, and the replacement content is ds1 > Product_type, as shown in the following figure.
3. Click Search to view the search results below. Click Replace and Product are replaced with Product_type, as shown in the following figure.
4. Click Save to save the replaced content. Click Preview.
Dashboard
Template Content
Take searching and replacing the text content in the dashboard as an example, and open Export_dashboard_with_parameters_by_JS.frm in the path %FR_HOME%\webroot\WEB-INF\reportlets\doc-EN\Dashboard.
1. Choose Template > Global Search and Replacement in the menu bar to bring up the Global Search and Replacement dialog box. Select Template Content, as shown in the following figure.
2. Set Search Element to Component and Search Range to Current Template (the default option), enter date in the drop-down box for the search content, and click Search to find the name and position information of the component in the current template that contains the date text, as shown in the following figure.
3. Enter day in the drop-down box for replacement, and click Replace. As a result, the date texts in the current template are replaced with day, as shown in the following figure.
4. Click Save to save the replaced content.
Set Item
Take searching and replacing Cell-Format in the dashboard as an example, and open Export_dashboard_with_parameters_by_JS.frm in the path %FR_HOME%\webroot\WEB-INF\reportlets\doc-EN\Dashboard.
1. Choose Template > Global Search and Replacement in the menu bar to bring up the Global Search and Replacement dialog box. Select Set Item, as shown in the following figure.
2. Select Cell-Data Setting in Search Element and Current Template in Search Range. The search content is Group > Common, and the replacement content is Summarize > Max, as shown in the following figure.
3. Click Search to view the results. Click Replace, as shown in the following figure.
4. Click Save to save the replaced content. Click Preview. The changes can be viewed in the following figure.