Common Master-Detail in Text Document

Note
In this article, we will use GroupDocs.Assembly to generate a Common Master-Detail report in Text Document format.

Common Master-Detail in Text Document

Reporting Requirement

As a report developer, you are required to represent the information of the customers and products with the following key requirements:

  • It must associate the customers with their products
  • Report must be generated in the HTML Document

Adding Syntax to be evaluated by GroupDocs.Assembly Engine

<<foreach [in customers]>><<[CustomerName()]>>
Products: <<foreach [in Order]>><<[indexOf() != 0 ? ", " : ""]>><<[Product.ProductName]>><</foreach>>
<</foreach>>
Tip
For detailed technical information about syntax, expressions and report generation by the engine, please visit: Working with GroupDocs.Assembly Engine.

Download Common Master-Detail Template

Please download the sample Common master-detail document we created in this article:

Generating The Report

Note
The example reads the shop data described in The Business Layer.
import json

from groupdocs.assembly import DataSourceInfo, DocumentAssembler

with open("customers.json", encoding="utf-8") as f:
    customers = json.load(f)

assembler = DocumentAssembler()
assembler.assemble_document("common-master-detail.txt", "common-master-detail-report.txt", DataSourceInfo(customers, "customers"))

The following sample file is used in this example: common-master-detail.txt

The following sample file is used in this example: customers.json

Quayside Bistro
Products: Harbor Blend whole bean coffee, Aged harbour cheddar, Cold-pressed olive oil

Lantern Street Café
Products: Lighthouse Espresso beans, Oat and honey biscuits

Saltmarsh Deli
Products: Chestnut honey, Smoked gouda, Autumn Harvest apple butter

Pier Nine Kitchen
[TRUNCATED]

Download full output

Close
Loading

Analyzing your prompt, please hold on...

An error occurred while retrieving the results. Please refresh the page and try again.