I. Overview
When different times are obtained through the parameter widget, if you want to obtain the day gap between the two dates. How to achieve it? As shown below:
Enter the start month and end month, and calculate the gap in the cell.
II. Application
1. Parameter pane
Add two "Text Field" widgets, two "Date" widgets, and one "Query" button in the parameter pane. As shown below:
Set the widget setting respectively. As shown in the figure below:
2. Report style
Set the report style and insert formulas in the cells. As shown below:
A2: $Start_month
B2: $End_month
C2: DATE(LEFT($Start_month, 4), RIGHT($Start_month, 2), 01)
D2: DATEINMONTH(DATE(LEFT($End_month, 4), RIGHT($End_month, 2), 01), -1)
E2: DATEDIF(DATE(LEFT($Start_month, 4), RIGHT($Start_month, 2), 01), DATEINMONTH(DATE(LEFT($End_month, 4), RIGHT($End_month, 2), 01), -1), 'D')
Note: DATEDIF takes the time, only one day is calculated at the beginning of the month and the end of the month. If you want to calculate both head and tail, just use the formula +1 in cell E.
3. Preview effect
Save the template, click pagination preview, the effect is shown in I.
Note: Both App and HTML5 are supported.
III. Download template
Completed template, please refer to: %FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\Parameter\Get_day_gap.cpt
Click to download: Get_day_gap.cpt