Report Table Group For Month and Day

I am attempting to make a report that would show production data by month, date, and eventually shift. However, I am encountering a strange issue using the Reporting Table Groups. I am using the following script to generate my 2 datasets.

def updateData(data, sample):
	#data['myKey']='Example'
	start = data['StartDate']
	end = data['EndDate']
	
	monthsBetween = system.date.monthsBetween(start, end)
	
	header = ['ts']
	monthsDS = []
	
	dayHeader = ['t_stamp']
	daysDS = []
	
	for i in range(monthsBetween):
		monthToProcess = system.date.addMonths(start, i)
		monthsDS.append([monthToProcess])
		
		daysBetween = system.date.daysBetween(monthToProcess, system.date.addMonths(monthToProcess, 1))
		for j in range(daysBetween):
			dayToProcess = system.date.addDays(monthToProcess, j)
			daysDS.append([dayToProcess])
			
		
	data['MonthsDS'] = system.dataset.toDataSet(header, monthsDS)
	data['DaysDS'] = system.dataset.toDataSet(dayHeader, daysDS)

When I preview the Report, everything looks correct in the sample data browser and the days are incrementing.

However, in the table, it simply lists the same date over and over.
image
image

Is there something about the table grouping that I am missing?

If the data coming back looks right and your finished report looks wrong, it's almost always an issue with your table layout. Unfortunately we can't see that part, so it's hard to say what's wrong with it, but I know more than once I've gotten the wrong key associated with something and had these kinds of results.

Thanks for getting back to me so quickly. Turns out it was an issue with the data key. When I dragged the field I wanted into the table, it formatted it as DaysDS.t_stamp.
image
This was incorrect and causing my issues. By deleting the DaysDS portion, I got the dates I was expecting.
image
It would be nice if the table could interpret my data key when I use the drag functionality to the child table. But I appreciate your help pointing me in the right direction!

3 Likes