Class Relation
Represents a master-detail relation between two data sources.
Implements
Inherited Members
Namespace: FastReport.Data
Assembly: FastReport.OpenSource.dll
Syntax
public class Relation : DataComponentBase, IFRSerializable
Remarks
To setup a relation, you must specify parent and child datasources. For a parent datasource,
you must specify set of key columns; for child datasource, you must specify set of columns that
relate to the parent key columns.
Report report1;
DataSourceBase customersTable = report1.Dictionary.DataSources.FindByAlias("Customers");
DataSourceBase ordersTable = report1.Dictionary.DataSources.FindByAlias("Orders");
Relation rel = new Relation();
rel.Name = "customersOrders";
rel.ParentDataSource = customersTable;
rel.ChildDataSource = ordersTable;
rel.ParentColumns = new string[] { "CustomerID" };
rel.ChildColumns = new string[] { "CustomerID" };
report1.Dictionary.Relations.Add(rel);
Constructors
Relation()
Initializes a new instance of the Relation class with default settings.
Declaration
public Relation()
Properties
ChildColumns
Gets or sets an array of child datasource columns.
Declaration
public string[] ChildColumns { get; set; }
Property Value
Type | Description |
---|---|
System.String[] |
Remarks
Note: both ParentColumns and ChildColumns must have the same number of elements.
ChildDataSource
Gets or sets the child datasource.
Declaration
public DataSourceBase ChildDataSource { get; set; }
Property Value
Type | Description |
---|---|
DataSourceBase |
ParentColumns
Gets or sets an array of parent datasource columns.
Declaration
public string[] ParentColumns { get; set; }
Property Value
Type | Description |
---|---|
System.String[] |
Remarks
Note: both ParentColumns and ChildColumns must have the same number of elements.
ParentDataSource
Gets or sets the parent datasource.
Declaration
public DataSourceBase ParentDataSource { get; set; }
Property Value
Type | Description |
---|---|
DataSourceBase |
Methods
Equals(Relation)
Compares this relation with another one.
Declaration
public bool Equals(Relation rel)
Parameters
Type | Name | Description |
---|---|---|
Relation | rel | Another relation to compare with. |
Returns
Type | Description |
---|---|
System.Boolean | true if both relations are equal; false otherwise. |
Serialize(FRWriter)
Serializes the object.
Declaration
public override void Serialize(FRWriter writer)
Parameters
Type | Name | Description |
---|---|---|
FRWriter | writer | Writer object. |
Overrides
Remarks
Do not call this method directly. You should override it if you are developing a new component for FastReport.
This method is called when the object needs to save the state. It may happen when:
- saving the report to the file or stream;
- saving the report to the designer's undo buffer;
- assigning the object to another object using the Assign(Base) or AssignAll(Base) methods;
- saving the object to the designer's clipboard;
- saving the object to the preview (when run a report).