mrc Documentation
michaels, ross & cole, ltd.
http://www.mrc-productivity.com/
|
|
Reference Grand Totals Anywhere within a Web 2.0 Report
This feature is ideal for those customers who wish to calculate % of Grand Total next to each detail line.
For instance, let’s say that we would like to pull up a list of Products and see their Month to Date units sold. I would also like to know, based upon the grand total of all units sold, what percentage of the grand total does each product account.
First, we will need to build our report, being sure to utilize the “Web 2.0 Report” template.

Once the report is compiled, open the report within m-Painter and select the Source view.

Let’s insert a column, so we have room to enter in our % of Grand Total data. Right click within the table and select “Inset Column.” The screen shot below shows the added column and additional text added to the detail row.

Save your application by clicking on the “Save and Deploy button.
Next, Click the “Application Defaults” button.

The last option, under the Program Options tab, is “edit_type.” Change the “edit_type” to “Text Editing Only.” Click the “OK” button. Note: This step is needed as the added flexibility with m-Painter is, at times, not compatible with certain fields.
A “pop-up” window will be displayed. Hit “OK.”
Change the “Page” drop down to list your property file (RXXXXXp.xml):
![]()
Next, click on the Application Properties button, and select “Text editing only.” This makes your change permanent.
![]()
Click OK. Then click the “Save and Deploy” button.
Change the “Page” drop down list back to the HTML output
![]()
Look for Begin Detail Level. This level is displayed below.

You can see where the additional text I added earlier, “% of Grand Total Goes Here,” went. I need to replace that text with
“<@calc> EXPR[9,2,J]= ${row.MTDUP_o} / ${grandTotal.MTDUP_o} * 100; </@calc>.%”
The <@calc> and </@calc> tell the servlet that a total level calculation is beginning and ending, respectively.
The EXPR[9,2,J] tells the servlet to perform a mathematical expression, creating a logical field that is length 9, with 2 decimal places.
The actual equation is the Month to Date Units Sold for the current row divided by the sum of all Month to Date Units Sold. Notice that “_o” had been added to each expression. This removes an edit codes that may have been on this field. This is required for fields that may have negative values.
Note: The trailing “;” is required.
Lastly, after the trailing </@calc> a “%” was added to denote percentage.
Hit the “Save and Deploy Icon.”
At run time, my output would look similar to this:

Notice: That while both fields are named “MTDUP” the divisor is coming from the “row” where the dividend is coming from the “Grand Total” line.