Two data sources can be linked by a relation defined in code, so a master-detail report resolves child rows for each parent.

Create parent and child sources.
StiDataTableSource parent = new StiDataTableSource("Demo.Parent", "Parent", "Parent");
parent.getColumns().add(new StiDataColumn("cId", "cId", StiSystemType.getSystemType("System.Object")));

StiDataTableSource child = new StiDataTableSource("Demo.Child", "Child", "Child");
child.getColumns().add(new StiDataColumn("cId", "cId", StiSystemType.getSystemType("System.Object")));
Define the relation between them.
ArrayList<String> cols = new ArrayList<String>();
cols.add("cId");

StiDataRelation rel = new StiDataRelation("Relation", parent, child, cols, cols);
report.getDictionary().getRelations().add(rel);

How it works. The relation lets a detail band filter child rows by the current parent row, producing master-detail output from code-built sources.
In the screenshot below you can see the result of the sample code:

Creating Report with Relations at Runtime

Hi. Need any help?