Cross Tab Query, Populating All Months on Yealry Recap
Posted on 2014-12-03
I am developing a yearly summary report for a client. The results will always be for a single year (Jan thru Dec) of collections.
I populate a table to use as the basis of a crosstab query. If I am populating the table for collections in January I only have results for January, populating in February there are results for Jan and Feb etc... The crosstab work exactly as it should, the issue comes when I want to create the output report.
When creating the report from the crosstab query, it references the column heading fields to place on the report. Since I am developing the report in November I have headings for January - November. This will work now but in December there will be no column to place the December results. Similarly, when I run the report next year, I initially won't have columns for the later months.
I ran into this situation once before and was given an EE solution that forced columns for all years on the crosstab result, whether or not they had data. This way the report could be developed using fields for Jan - Dec and they would always be there. Unfortunately that was several years ago and I don't remember the solution, nor do I have a copy of the application where I used the technique.
As a fall back I know I can create logic that makes sure to insert at least one record for each month into the table used as the basis of the crosstab query but I know there is a much cleaner solution using just the crosstab query.
Anyone know how to do this?