Show / Hide Table of Contents

Class Relation

Represents a master-detail relation between two data sources.

Inheritance
System.Object
Base
DataComponentBase
Relation
Implements
IFRSerializable
Inherited Members
DataComponentBase.Alias
DataComponentBase.Enabled
DataComponentBase.ReferenceName
DataComponentBase.Reference
DataComponentBase.IsAliased
DataComponentBase.Assign(Base)
DataComponentBase.SetName(String)
DataComponentBase.InitializeComponent()
Base.Name
Base.Restrictions
Base.Flags
Base.Parent
Base.BaseName
Base.ClassName
Base.Report
Base.Page
Base.ChildObjects
Base.AllObjects
Base.ZOrder
Base.IsAncestor
Base.IsDesigning
Base.IsPrinting
Base.IsRunning
Base.OriginalComponent
Base.SetProp(Base, Base)
Base.FloatDiff(Single, Single)
Base.DeserializeSubItems(FRReader)
Base.ExtractDefaultMacros(String)
Base.Dispose(Boolean)
Base.SetFlags(Flags, Boolean)
Base.SetReport(Report)
Base.SetParent(Base)
Base.SetParentCore(Base)
Base.FindObject(String)
Base.CreateUniqueName()
Base.Clear()
Base.Deserialize(FRReader)
Base.BaseAssign(Base)
Base.AssignAll(Base)
Base.HasParent(Base)
Base.HasFlag(Flags)
Base.HasRestriction(Restrictions)
Base.InvokeEvent(String, Object)
Base.OnAfterLoad()
Base.GetExpressions()
Base.GetCustomScript()
Base.ExtractMacros()
Base.IsHaveToConvert(Object)
Base.GetConvertedObjects()
Base.ForEachAllConvectedObjects(Object)
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. This example shows how to create relation between Customers and Orders tables:

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
DataComponentBase.Serialize(FRWriter)
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).

Implements

IFRSerializable
Back to top Generated by DocFX