Salesforce

How Do I Create Report Break Levels? (Magic xpa 4.x)

« Go Back

Information

 
Created BySalesforce Service User
Approval Process StatusPublished
Objective
Description

How Do I Create Report Break Levels? (Magic xpa 4.x)

Reports often have break levels, where data is grouped together and subtotals are printed. This can be one of the most challenging things to do in a lower-level language, but Magic xpa has built-in functionality that makes it easy to create even very complex break level reports. In this section we will show you how. Here is a summary of the steps:

  1. Make sure your record order matches the break level

  2. Set up a variable that will change at the right time

  3. Set up your Group levels

  4. Sum the totals

Now let’s go through them step by step.

1. Make sure your record order matches the break level

One of the most common errors on break level reports is using the wrong record order. In our example, we are going to group records by “Studio”. So, we also have to be sure we use the “Studio” index.

If there is no index that will work for the report you want, you can use Task->Sort to create a customized record order for this task. See Sort the records without defining an index.

2. Set up a variable that will change at the right time

Usually, you will have a variable in the DB Source that you can use for a break level. In our example, since the records are ordered by “Studio”, we will use the Studio column to break on.

In some cases, however, there will not be a variable handy. For instance, if you want to create a report that summarizes data by month, but only have a date field in the data. The records would be ordered correctly, by date, but there is no field that changes just when the month changes.

In that event, you would set up a variable called, for instance, v.Month, and initialize it to the month part of the date, using the Month() function, as shown here. Or, you could concatenate several fields together to cause a break only when any one of those fields change. Virtuals can be used for break levels just like Columns can.

3. Set up your Group levels

Next, you want to set up your Group levels. The Group levels will point to the variable you are using for the break, which in this example is the Studio column.

In Group Prefix, you will print out the header (if you are using one) and zero out the totals that are used in this break.

In Group Suffix, you will print out the footer (if you are using one.

Alternatively, you can zero out the break level in Group Suffix, after you print the form. Either method works, but it’s good to be consistent.

4. Sum the totals

Last, you need to update your totals whenever you print a record. Usually this is done in Record Suffix, with simple Update operations.

See also

The Online and Rich Client Samples projects (program RP04 and RRP04)

Reference
Attachment 
Attachment