Monday, April 23, 2007

Totals and blank lines

The following is an interesting conundrum that I have come across recently and is something that you might be interested in knowing about. It's concerned with what happens when you combine sub-totals and additional rows between group sorted items.

Example:

In the following worksheet, as shown in illustration 1, you can see that I have a group sort on the Customer with a sub-total on the Profit. A not uncommon scenario I hope you will agree.

Illustration 1: A group sort with the sub-total displayed correctly

Next, I right-clicked in the Customer and from the pop-up menu selected Format Table. Discoverer opened up the Format Data dialog box. This box has three tabs:
  • Format - on this tab you set up the standard formatting characteristics such as font, size, background color, foreground color, alignment and so on

  • Text - on this tab you can set additional characteristics such as uppercase, lowercase or capitalization

  • Breaks - on this tab, which is only enabled if you are formatting a Group Sort, you can control what happens when group sorted items change. As you can see in illustration 2, I have enabled a line width of 2 in red, and the insertion of one blank row between each group sorted item.
Illustration 2: The Format Data dialog box and the Breaks tab

After I clicked the OK button in the above box, Discoverer redrew my screen, but drew it incorrectly as shown below in illustration 3. As you can see, the totals still calculate correctly. But take a close look at what happened on the totals line for each sub-total other than the first one. As you can see, the word NULL has been inserted against each of the other items. In addition, take a very close look at row 9 and in particular at the cell value containing the Profit. As you will see, Discoverer has placed the Sum label here instead of alongside the $23,939.00 on the previous row.

It therefore appears that the insertion of an additional line for the group sort has caused the label to move down by that number of rows also. This means that Discoverer does not know what to do with the cell values on the original sub-total and so it inserted a NULL value. Formatting the table to change the display of NULL values to something other than NULL does indeed change the wording.

Illustration 3: A group sort with the sub-total displayed incorrectly

Therefore, please be very careful when using additional lines between group sorted items when there are sub-totals. The following illustration shows the same worksheet displayed in Viewer. As you can see below in illustration 4, Viewer does not appear to have this issue. I can therefore only assume it is something to do with the Java.

Illustration 4: The same group sort, as seen in Viewer, with the sub-total displayed correctly

1 comment:

Unknown said...

Hi i make one report and when i want to see the graph Pie or Bar i get on tooltip or hint the follow value 1,000 when the real value is 1.

¿Is possible customize the graph tooltip format value or number?

Thanks

Followers