Class Dictionary
This class stores all report data items such as datasources, connections, relations, parameters, system variables.
Inherited Members
Namespace: FastReport.Data
Assembly: FastReport.OpenSource.dll
Syntax
public class Dictionary : Base, IFRSerializable, IParent
Remarks
You can access the report dictionary via Report.Dictionary property.
Constructors
Dictionary()
Initializes a new instance of the Dictionary class with default settings.
Declaration
public Dictionary()
Properties
Connections
Gets a collection of connection objects available in a report.
Declaration
public ConnectionCollection Connections { get; }
Property Value
Type | Description |
---|---|
ConnectionCollection |
CubeSources
Gets a collection of cubesources available in a report.
Declaration
public CubeSourceCollection CubeSources { get; }
Property Value
Type | Description |
---|---|
CubeSourceCollection |
Remarks
Usually you don't need to use this property. It contains only cubesources registered using the RegisterData method.
DataSources
Gets a collection of datasources available in a report.
Declaration
public DataSourceCollection DataSources { get; }
Property Value
Type | Description |
---|---|
DataSourceCollection |
Remarks
Usually you don't need to use this property. It contains only datasources registered using the RegisterData method. All other datasources are contained in connection objects and may be accessed via Connections property.
Parameters
Gets a collection of parameters.
Declaration
public ParameterCollection Parameters { get; }
Property Value
Type | Description |
---|---|
ParameterCollection |
Remarks
Another way to access parameters is to use the Report.Parameters property which is actually a shortcut to this property. You also may use the Report.GetParameter and Report.GetParameterValue methods.
RegisteredItems
Gets a list of registered items.
Declaration
public List<Dictionary.RegDataItem> RegisteredItems { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<Dictionary.RegDataItem> |
Remarks
This property is for internal use only.
Relations
Gets a collection of relations.
Declaration
public RelationCollection Relations { get; }
Property Value
Type | Description |
---|---|
RelationCollection |
SystemVariables
Gets a collection of system variables like Date, PageNofM etc.
Declaration
public SystemVariables SystemVariables { get; }
Property Value
Type | Description |
---|---|
SystemVariables |
Remarks
Another way to access a system variable is to use the Report.GetVariableValue method.
Totals
Gets a collection of totals.
Declaration
public TotalCollection Totals { get; }
Property Value
Type | Description |
---|---|
TotalCollection |
Remarks
Another way to get a total value is to use the Report.GetTotalValue method.
Methods
AddChild(Base)
Adds a child object to this object's childs.
Declaration
public void AddChild(Base child)
Parameters
Type | Name | Description |
---|---|---|
Base | child | Object to add. |
Assign(Base)
Copies the contents of another, similar object.
Declaration
public override void Assign(Base source)
Parameters
Type | Name | Description |
---|---|---|
Base | source | Source object to copy the contents from. |
Overrides
Remarks
Call Assign to copy the properties from another object of the same type. The standard form of a call to Assign is
destination.Assign(source);
which tells the destination object to copy the contents of the source object to itself. In this method, all child objects are ignored. If you want to copy child objects, use the AssignAll(Base) method.
See Also
CanContain(Base)
Gets a value indicating that this object can contain the specified child object.
Declaration
public bool CanContain(Base child)
Parameters
Type | Name | Description |
---|---|---|
Base | child | Child object. |
Returns
Type | Description |
---|---|
System.Boolean | true if this object can contain the specified child object; otherwise, false. |
ClearRegisteredData()
Clears all registered data.
Declaration
public void ClearRegisteredData()
CreateUniqueAlias(String)
Creates unique alias for data item such as connection, datasource or relation.
Declaration
public string CreateUniqueAlias(string alias)
Parameters
Type | Name | Description |
---|---|---|
System.String | alias | The base alias. |
Returns
Type | Description |
---|---|
System.String | The new unique alias. |
Remarks
Use this method to create unique alias of the data item. It is necessary when you create new
items in code to avoid conflicts with existing report items.
Report report1;
DataConnectionBase conn = report1.Dictionary.Connections.FindByName("Connection1");
TableDataSource table = new TableDataSource();
table.TableName = "Employees";
table.Name = report1.Dictionary.CreateUniqueName("EmployeesTable");
table.Alias = report1.Dictionary.CreateUniqueAlias("Employees");
conn.Tables.Add(table);
CreateUniqueName(String)
Creates unique name for data item such as connection, datasource, relation, parameter or total.
Declaration
public string CreateUniqueName(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The base name. |
Returns
Type | Description |
---|---|
System.String | The new unique name. |
Remarks
Use this method to create unique name of the data item. It is necessary when you create new
items in code to avoid conflicts with existing report items.
Report report1;
Parameter par = new Parameter();
par.Name = report1.Dictionary.CreateUniqueName("Parameter");
report1.Parameters.Add(par);
Deserialize(FRReader)
Deserializes the object.
Declaration
public override void Deserialize(FRReader reader)
Parameters
Type | Name | Description |
---|---|---|
FRReader | reader | Reader 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 restore the state. It may happen when:
- loading the report from a file or stream;
- loading the report from the designer's undo buffer;
- assigning another object to this object using the Assign(Base) or AssignAll(Base) methods;
- loading the object from the designer's clipboard;
FindByAlias(String)
Finds a data item such as connection, datasource or relation by its alias.
Declaration
public DataComponentBase FindByAlias(string alias)
Parameters
Type | Name | Description |
---|---|---|
System.String | alias | The item's alias. |
Returns
Type | Description |
---|---|
DataComponentBase | The data item if found; otherwise, null. |
FindByName(String)
Finds a data item such as connection, datasource, relation, parameter or total by its name.
Declaration
public Base FindByName(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The item's name. |
Returns
Type | Description |
---|---|
Base | The data item if found; otherwise, null. |
FindDataComponent(String)
Finds a data component that matches the specified reference name.
Declaration
public DataComponentBase FindDataComponent(string referenceName)
Parameters
Type | Name | Description |
---|---|---|
System.String | referenceName | The name to check. |
Returns
Type | Description |
---|---|
DataComponentBase | The DataComponentBase object if found. |
Remarks
This method is for internal use only.
FindDataTableSource(DataTable)
Finds a datasource that matches the specified DataTable.
Declaration
public DataSourceBase FindDataTableSource(DataTable table)
Parameters
Type | Name | Description |
---|---|---|
DataTable | table | The DataTable object to check. |
Returns
Type | Description |
---|---|
DataSourceBase | The DataSourceBase object if found. |
Remarks
This method is for internal use only.
GetChildObjects(ObjectCollection)
Gets a list of child objects.
Declaration
public void GetChildObjects(ObjectCollection list)
Parameters
Type | Name | Description |
---|---|---|
ObjectCollection | list | List to fill with values. |
GetChildOrder(Base)
Returns z-order of the specified child object.
Declaration
public int GetChildOrder(Base child)
Parameters
Type | Name | Description |
---|---|---|
Base | child | Child object. |
Returns
Type | Description |
---|---|
System.Int32 | Z-order of the specified object. |
Remarks
This method must return the index of a specified child object in the internal child list.
Load(Stream)
Loads the dictionary from a stream.
Declaration
public void Load(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | The stream to load from. |
Load(String)
Loads the dictionary from a file.
Declaration
public void Load(string fileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | The name of a file to load from. |
Merge(Dictionary)
Merges this dictionary with another Dictionary.
Declaration
public void Merge(Dictionary source)
Parameters
Type | Name | Description |
---|---|---|
Dictionary | source | Another dictionary to merge the data from. |
RegisterBusinessObject(IEnumerable, String, Int32, Boolean)
Registers a business object.
Declaration
public void RegisterBusinessObject(IEnumerable data, string referenceName, int maxNestingLevel, bool enabled)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.IEnumerable | data | The business object. |
System.String | referenceName | The name of the object. |
System.Int32 | maxNestingLevel | Maximum level of data nesting. |
System.Boolean | enabled | Determines wheter to enable the object or not. |
Remarks
This method is for internal use only.
RegisterCubeLink(IBaseCubeLink, String, Boolean)
Registers a CubeLink.
Declaration
public void RegisterCubeLink(IBaseCubeLink cubeLink, string referenceName, bool enabled)
Parameters
Type | Name | Description |
---|---|---|
IBaseCubeLink | cubeLink | The CubeLink to register. |
System.String | referenceName | The name of the data object. |
System.Boolean | enabled | Determines wheter to enable the object or not. |
Remarks
This method is for internal use only.
RegisterData(Object, String, Boolean)
Registers a data object.
Declaration
public void RegisterData(object data, string name, bool enabled)
Parameters
Type | Name | Description |
---|---|---|
System.Object | data | The object to register. |
System.String | name | The name of the object. |
System.Boolean | enabled | Determines wheter to enable the object or not. |
Remarks
This method is for internal use only.
RegisterDataView(DataView, String, Boolean)
Registers a DataView.
Declaration
public void RegisterDataView(DataView view, string referenceName, bool enabled)
Parameters
Type | Name | Description |
---|---|---|
DataView | view | The DataView to register. |
System.String | referenceName | The name of the data object. |
System.Boolean | enabled | Determines wheter to enable the object or not. |
Remarks
This method is for internal use only.
RemoveChild(Base)
Removes a specified object from this object's childs.
Declaration
public void RemoveChild(Base child)
Parameters
Type | Name | Description |
---|---|---|
Base | child |
ReRegisterData()
Re-registers the data registered before.
Declaration
public void ReRegisterData()
Remarks
This method is for internal use only.
ReRegisterData(Dictionary)
Re-registers the data registered before.
Declaration
public void ReRegisterData(Dictionary dictionary)
Parameters
Type | Name | Description |
---|---|---|
Dictionary | dictionary |
Save(Stream)
Saves the dictionary to a stream.
Declaration
public void Save(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | Stream to save to. |
Save(String)
Saves the dictionary to a file.
Declaration
public void Save(string fileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | The name of a file to save to. |
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).
SetChildOrder(Base, Int32)
Sets the z-order of the specified object.
Declaration
public void SetChildOrder(Base child, int order)
Parameters
Type | Name | Description |
---|---|---|
Base | child | Child object. |
System.Int32 | order | New Z-order. |
Remarks
This method must place the specified child object at the specified position in the internal child list.
UnregisterData(Object)
Unregisters the previously registered data.
Declaration
public void UnregisterData(object data)
Parameters
Type | Name | Description |
---|---|---|
System.Object | data | The application data. |
UnregisterData(Object, String)
Unregisters the previously registered data.
Declaration
public void UnregisterData(object data, string name)
Parameters
Type | Name | Description |
---|---|---|
System.Object | data | The application data. |
System.String | name | The name of the data. |
Remarks
You must specify the same data and name as when you call RegisterData.
UpdateLayout(Single, Single)
Updates the children layout when the size of this object is changed by dx, dy values.
Declaration
public void UpdateLayout(float dx, float dy)
Parameters
Type | Name | Description |
---|---|---|
System.Single | dx | X delta. |
System.Single | dy | Y delta. |
Remarks
This method must update positions/sizes of child objects whose Dock or Anchor properties are set to non-default values.
UpdateRelations()
Enables or disables relations between data tables.
Declaration
public void UpdateRelations()
Remarks
Call this method if you create master-detail report from code. This method enables relation between two data tables which Enabled flag is set to true. Relations whose parent and child tables are disabled, gets disabled too.