How to Display the Last Row of Detail within Subtotals

 

Inevitably, you will encounter a time when a Report will subtotal and grand total numeric fields that you do not wish to be totaled. The reason these fields are totaled is because they are Numeric Fields. Notice the screen shot below:

You will notice that the Customer Number has been added for each customer number. Notice the problem this can become if the detail line is not printed.

Notice now that the end user has no way to discern what each customer’s number is.

There is a very easy solution to this problem — m-Painter.

Notice the circled “CUSNO”. This is the field that is being summed. Select the field, then delete it from m-Painter. Be sure to click your curser in the now empty cell.

Next click the “Insert Data Field” button on the m-Painter toolbar:

Select the correct field, then under “Report/Summary For:”, select “Last Row of Detail”. This will, at run time, not add up the field as the subtotal did, but rather simply place the last instance of the detail row on the subtotal line. The benefit of this is that your report, regardless whether it is running in Subtotal or Detail view, will always display the correct Row Information.

After doing this, remove the Customer Number entirely from the grand total row since it is not needed. Note how the Customer Name is automatically populated with the last row of detail at the subtotal level since it is the sequence key. After making the changes and saving, the output now looks like this:

In Detail mode:

In Summary mode: