VirtualDataTable Class
Base class for a table used on FlexCelReport. Inherit from this class and VirtualDataTableState to create your custom sources of data. Make sure you read 'Appendix virtual datasets' in the Reports Developer Guide for more information.
Syntax
Namespace: FlexCel.Report
public abstract class VirtualDataTable: IDisposable
Constructors
Name | Description |
---|---|
VirtualDataTable | Creates a new virtual datatable instance and assigns a name to it. |
Methods
Name | Description |
---|---|
CreateState | Creates a VirtualDataSetState to be used in a report. Make sure you override this method on your derived classes and point it to the correct VirtualDataSet descendant. |
FullDataSetColumnCount | Returns the columns in the table for a full dataset. Normally this is the same as ColumnCount but your implementation might choose to hide some of the fields available in the full ColumnCount when dumping all fields. If you change this method, you need also to review GetFullDataSetColumn so it returns the correct column for the dataset. |
GetFullDataSetColumn | Maps a normal column to a Full Dataset column, in case you aren't outputting the same fields for full datasets as the fields available for a report. If you are outputting all the fields, then this returns Column. |
GetFullDataSetMapId | Returns an id you can use to map a column name + * to something you can use in GetFullDataSetColumn |
GetColumn | Returns a column identifier that you can later use on VirtualDataTableState.GetValue(Int32). Return -1 if the column does not exist, and make sure this search is case insensitive. |
GetColumnName | Returns the column name for a column identifier. This method is the reverse of GetColumn |
GetColumnCaption | Returns the column caption for a column identifier. This method is used on generic dataset to write the header column. For most uses, GetColumnName will be used. |
FilterData | This method should return a new VirtualDataTable instance with the data filtered. If RowFilter is null, this method should return a copy of the dataset with a different name. Note that you might have the same data with different states, so this method might be called more than once. |
GetDistinct | Override this method to return a new VirtualDataSet with unique values. Note that the returned dataset will not have all the columns this one has, only the ones defined on "filterFields" |
GetDetail | Override this method if the table has linked tables that you can use for master detail relationships instead of normal relationships. This is the case for example in Entity Framework. |
GetRelationWith | Override this method if the datatable has intrinsic relationships that you want to use. For example DataSets have DataRelationships, or Entity Framework tables are related as properties from the master to the detail. All those relationships that are not explicitly defined in the report should be returned here. |
Lookup | Looks for a key on this dataset and returns the corresponding value. Note: Remember that VirtualDataSet is stateless, so if you use any caching here, make sure you appropiately lock() this method so there is no possibility of one thread reading the cache when the other is updating it. |
Dispose | Overloaded Dispose Dispose(Boolean) |
Properties
Name | Description |
---|---|
TableName | Name for the virtual data table. Note that this name is *not* used anywhere in FlexCel code, except to report errors. The Table names that are used on reports are the ones in VirtualDataTableState |
Locale | Locale for this dataset. This might be needed to create datatables with data and the same locale. |
ColumnCount | Returns the number of columns of the table. |
CreatedBy | Returns the table that created this one (by a filter, distinct, etc), or null if this table was not created from another VirtualDataTable. |