Description
Line charts that trend by a date field per week do not properly display records for a group when week is split between two years.
The behavior can also be replicated using a GlideAggregate script.
Steps to Reproduce
-
Create or import some Changes and Incidents with a sys_created_on date and time between 2016-12-26 23:59:59 and 2017-01-09 00:00:00.
-
Create a Line Chart report with the following values:
Type: Line Chart
Table: Task
Group: Task type
Trend: Created per Week Enable Display grid
Filter: Created after 2016-12-26 23:59:59 and Created before 2017-01-09 00:00:00For more information, see the documentation topic Line reports.
-
Execute the report.
Observe the differences between the chart and grid list.
Note that the behavior can also be replicated using a GlideAggregate script:
var ga = new GlideAggregate("task"); ga.addEncodedQuery("sys_created_on>javascript:gs.dateGenerate('2016-12-26','23:59:59')^sys_created_on<javascript:gs.dateGenerate('2017-01-09','00:00:00')"); ga.addTrend("sys_created_on","week"); ga.addAggregate("COUNT","sys_class_name"); ga.query(); gs.info("Task type"+"\t"+"Count") while(ga.next())
gs.info(ga.sys_class_name+"\t"+ga.getAggregate("COUNT","sys_class_name"))
Workaround
Upgrade to the fixed versions NP9 / OP4 / Paris and then:
1. Add the 'glide.db.aggregates.trend.use_iso_week' and set value to true.
2. Verify that the report is show correct results.
It is recommended to test /validate via a subprod instance prior to implementing in production.
Note that all trend per week reports will no more consider week buckets defined as 7 days intervals after each "start of week day" (that is configurable via sys property).
After configuring glide.db.aggregates.trend.use_iso_week to true, These reports will consider week bucket as defined by ISO standard.
Also the user will not be able to choose this by report as of now this is a system configuration.
Related Problem: PRB594423