

public class Join : WebReports.Api.Common.ConfigObj
// INNER JOIN Products ON Categories.CategoryId > Products.CategoryId // OR (Categories.CategoryId = Products.CategoryId // AND Categories.CategoryId = Products.ProductId) var join = new Join(api.PageInfo) { EntityFromName = "Categories", EntityToName = "Products", Type = (int)JoinType.Inner, }; join.JoinColumns.Add(new JoinColumn( new KeyColumn(join.EntityFromName, "CategoryId", JoinExpressionType.Column), JoinComparison.GT, new KeyColumn(join.EntityToName, "ProductId", JoinExpressionType.Column), JoinConjunction.OR, 0 // nesting level - number of parens surrounding the expression )); join.JoinColumns.Add(new JoinColumn( new KeyColumn(join.EntityFromName, "CategoryId", JoinExpressionType.Column), JoinComparison.EQ, new KeyColumn(join.EntityToName, "CategoryId", JoinExpressionType.Column), JoinConjunction.AND, 1 )); join.JoinColumns.Add(new JoinColumn( new KeyColumn(join.EntityFromName, "CategoryId", JoinExpressionType.Column), JoinComparison.EQ, new KeyColumn(join.EntityToName, "ProductId", JoinExpressionType.Column), JoinConjunction.OR, 1 )); // api.Joins.Add(join); // add at the application level // report.Joins.Add(join); // or at the report level
Entity fromEntity = api.Entities.GetEntity("fromName"); Entity toEntity = api.Entities.GetEntity("toName"); Join newJoin = new Join(api.PageInfo) { EntityFromName = fromEntity.Name, EntityToName = toEntity.Name, Type = (int)JoinType.Inner, RelationType = 0, // 0: One-to-One, 1: One-to-Many Weight = 0 }; // Add key columns newJoin.JoinColumns.Add(new JoinColumn( new KeyColumn(fromEntity.Name, fromEntity.GetColumn("fromColName").ActualFullName), new KeyColumn(toEntity.Name, toEntity.GetColumn("toColName").ActualFullName) )); // Add to the config; for reports, use report.Joins.Add() api.Joins.Add(newJoin); // If there is an active report, recreate the joins report.CreateJoins();
System.Object
WebReports.Api.Reports.Join