I. Overview
1. Problem Description
When introducing Printing or exporting check boxes when data entrying, we already know that the method of modifying configuration items only supports printing or exporting Checkbox and Checkbox Groupwidget.
However, when making some reports and contracts, there may be a Radio Button Groupwidget in the cell. When exporting and printing, only the selected value is displayed by default, and other values are not displayed. So how can we print or export all theRadio Button Group widget?
2. Solutions
When exporting and printing, the cell value will be affected by the form setting, so it can be realized by setting the displayed value of the Cell Attributes > Display > Data Dictionary and using the special symbols . For each different selection, a different displayed value selection state can be set.
II. Example
1. Report Design
Create the dataset ds1, and extract 5 pieces of data through SQL:
Create a new ordinary report, and add a Radio Button Groupwidget to cells B1 and B2. The table style is as shown in the following figure:
Set the Radio Button Group widget data dictionary of B1 and B2 cells to ds1, and the actual value and display value are both Product_ name fields. Select Adaptive:
2. Method 1: Set the form one by one
Select cell B1, select Cell Attributes > Display, and set it to Data Dictionary > Custom. As shown in the following figure:
Set the actual and displayed values as shown in the following table:
Actual Value | Display Value |
Apple Juice | ● Apple juice ○ Milk ○ Ketchup ○ Salt ○ Sesame oil |
Milk | ○ Apple juice ● Milk ○ Ketchup ○ Salt ○ Sesame oil |
Ketchup | ○ Apple juice ○ Milk ● Ketchup ○ Salt ○ Sesame oil |
Salt | ○ Apple juice ○ Milk ○ Ketchup ● Salt ○ Sesame oil |
Sesame oil | ○ Apple juice ○ Milk ○ Ketchup ○ Salt ● Sesame oil |
When inputting the above display values, ● and ○ are the character strings input through the special characters.
3. Method 2: Unified setting form
The first method needs to be set one by one. It is not easy to use when there are many options in the Radio Button Group widget or the options will change later. Therefore, there is another unified setting method, which needs to use a formula to judge and process.
Select cell B2, select Cell Attributes > Display, and set it to Data Dictionary > Formula Form. As shown in the following figure:
The setting formula is:joinarray(MAPARRAY(value("ds1", "Product_name"), if(item = $$$, "●", "○") + item), " ")
Formula description:
value("ds1", "Product_name"): Retrieve all values in the Product_name column of the ds1 dataset, and return an array of values
MAPARRAY(value("ds1", "Product_name"), if(item = $$$, "●", "○") + item): Traverse the array. If it is the currently selected value, ● will be inserted in the front, and ○ will be inserted in the front for other values
joinarray(MAPARRAY(value("ds1", "Product_name"), if(item = $$$, "●", "○") + item), " "): Convert the array to a string with a space as the separator
4. Effect preview
Save the report and click Data Entry Preview, as shown in the following figure:
Click Printor Export, Excel, Word, PDF and pictures can be exported normally, as shown in the following figure:
Method 1: Export and print are not supported when no value is selected for the button group widget
Method 2: Export and print are not supported when the button group widget has no default value and has not been edited after previewing
III. Template Download
The completed template can be found at:%FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\Form\FormFAQ\Print_and_export_radio_button_group_widget .cpt
Click to download the template:Print_and_export_radio_button_group_widget.cpt