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.

By using this website, you agree to the use of cookies for analytics and personalized content. Cookies store useful information on your computer to help us improve efficiency and usability. For more information, please read the privacy policy and cookie policy.