Salesforce

How Do I Present Data as Grouped, Within a Predefined HTML Template? (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

How Do I Present Data as Grouped, Within a Predefined HTML Template? (Magic xpa 3.x)

If you are writing data to an HTML template and want to group data, the best way to do that is with an HTML table. You can have multiple HTML tables in one file, and use styling to format them nicely.

For instance, here are two separate lists, grouped together into one HTML form:

Two different tasks were used to route these to the same file (as shown in How Do I Merge Data into One Document From Several Tasks?).

The template used uses MGREPEAT tags to actually create the HTML table, as shown here.

The first task writes DVD records, and only refers to the first two tags, MG_SN and MG_Title.

The second task only writes Studio records, and so writes the MG_Studio and MG_StudioName lines.

You can do something similar to group data that is within one data source also. In this example, we grouped the DVDs according to their Studio code.

Here, a separate HTML table is created for each group.

Now, let’s see how this was done.

1. Setting up the template

The template uses nested MGREPEAT tags. The inner MGREPEAT creates the “detail” rows, as it would in any report. The tags MG_SN and MG_Title will be output in Record suffix, so there will be one line per record.

The outer MGREPEAT writes the Studio name in big letters, and it also handles the declaration of the HTML table and the table headers.

2. Writing the detail line

The detail line is written to in Record Suffix, as you would expect in any report.

However, the Form that is being output, DVD Line, only refers to the tags within the inner MGREPEAT.

So, the Output Form only causes one more DVD line to be written.

3. Writing the header

The header is written in a Group Prefix logic unit. This kind of logic unit will only execute when the variable it refers to changes. Since the Data View uses the Studio index, the Studio Header will only be written once per Studio. This works the same as it would for a GUI report.

The Studio Header form only refers to the tags in the outer MGREPEAT tag. So, when the Form Output is executed, a new <H3> header is written, and a new HTML table is written.

See also

The Online and Rich Client Samples projects (program MG12 and RMG12)

Reference
Attachment 
Attachment