mrc Documentation
michaels, ross & cole, ltd.
http://www.mrc-productivity.com/

 


Controlling Report Output to Show only First Record of Detail Information (Avoiding Redundant Data)

 

Note: This documentation is only for the Standard Report Templates. Controlling output in this fashion is handled differently with a Web 2.0 Report. Click here to learn how it is done.

In this documentation, we will cover the topic of controlling report output so that only certain information is shown for the first record within a detail section. Imagine this scenario; you have generated a report that has Customer Sales Information, subtotaled by customer. If you look at the detail rows for any give customer certain information (such as their name) will be repeated on every single line within the subtotal section.

 

For some customers, the redundant data (as is the customer name in the screen shot above) is unnecessary. The steps below will show you how to display only the Customer Name once per section break.

 

Step 1: Build Calculation #1

The first step, after adding the appropriate files and sequencing, is building a calculation. This calculation should contain If/Else logic and determine if the Customer Name equals the Customer Name from the row above. If it does, do not display the Customer Name for this row. To do this, we will need to create a control calculation (more about this in Step 2).

 

 

The screen above says: If the Customer Name is Equal to 1, then print a blank (“”). [mrc-PS users will replace “” with SPC_].

We are using “1” within the Value of our If/Else Statement as a placeholder. We are going to place the calculation from Step 2 there; however we need to build it first. Click Accept.

 

Click the “Add” link and for the value of the “Else” calculation place the substitution

 

Below is the screenshot of the completed If/Else Logic.

 

Step 2: Build Calculation #2

Next we need to build our control calc. This calc will be very basic and will simply be equal to the Customer Name.

Note: This step is crucial. Not only is this needed, but it is important that this calc be made after Calculation 1. This will ensure that this feature will work properly.

 

 

Step 3: Correct Calculation #1

Now that Calculation #2 is made, we can correct Calculation #1. Click the “Update” link for Calculation #1 from the “Work with Calculations” screen. Click “Update” again on the first row. This will allow us to modify the If/Else Logic.

Click the “Look Up” link directly next to the Value field within the If/Else logic, and select your Calculation #2.

 

Click Accept.

 

You are now ready to Build/Compile your application. (For this tutorial we will not hide any fields, however in a live application, you may want to enter Preformat and hide the real Customer Name Field and the Control Calc as they are not needed for view, but only for behind-the-scenes logic.

 

 

Looking at the above screenshot, you can see that the Customer Name (left column) has not changed at all, however Calculation #1 only shows one customer name per section break.

 

The servlet is handled one row at a time. The first row is read and Calculation #1 is preformed. Since Calculation #2 is empty, it does not equal “A1 Cycle City” so “A1 Cycle City” is loaded into Calculation #1. However, all subsequent rows show Calculation #1 printed as blank because the Control Calc from the line above always equals the Customer Name. When the section is broken, the first row is read for A/B Cycle Shoppe. Since A-1 Cycle City does not equal A/B Cycle Shoppe, “A/B Cycle Shoppe” is printed.

 

Step 4: Finalize in m-Painter

As stated above, much of what is being handled in Step #4 can be accomplished in Pre-Format. However, Step #4 assumes that you do not want to overwrite existing HTML and must make changes via m-Painter.

 

Once m-Painter is opened, you may seen a screen like this:

 

 

Since Control Calc is only needed for logic purposes, we can remove it from the screen. Right click the column, and select “Delete Column.”

Next, [CNAME] is also not needed (This is the field that repeats itself). Delete this field. Your screen should now look something like this:

 

Ultimately, we would like Calculation #1 to be seen under the “Customer Name” column. To achieve this, click and drag [CALCULA001] to the Customer Name “Detail Level” and drop it.

 

Lastly, since the “Customer Name (Printed)” column now is empty, we can delete it. Right click on the column, and select “Delete Column.”

 

Click the “Save and Deploy” icon. Now when the application is run, we see this output: