Class ReportEndFunction
Post-processes the assembled report data set after all queries have been executed.
Implements
Inherited Members
Namespace: PayrollEngine.Client.Scripting.Function
Assembly: PayrollEngine.Client.Scripting.dll
Syntax
public class ReportEndFunction : ReportFunction, IDisposable
Remarks
This function runs once per report execution, after the report engine has populated the DataSet from all registered queries. It receives the complete data set and can add, remove, or transform tables, define inter-table relations, and execute supplementary queries.
Typical uses:
- Execute supplementary queries and add the results as new tables (ExecuteResultQuery(string, string, Dictionary<string, string>)).
- Remove intermediate or temporary tables that should not appear in the output (RemoveTables(params string[])).
- Add parent-child relations between tables for hierarchical reports (AddRelation(string, string, string, string)).
- Compute aggregates or derived values directly on the data set (Compute<T>(string, string, string)).
- Merge additional data into an existing table via ExecuteMergeQuery(string, string, string, Dictionary<string, string>, DataMergeSchemaChange).
Return value: Return null to deliver the data set to the renderer.
Return false to abort report delivery after data assembly.
Examples
// Remove a staging table and add a parent-child relation
RemoveTable("TempEmployees");
AddRelation("PayrollEmployees", "Payrolls", "WageTypeResults", "PayrollResultId");
Constructors
View SourceReportEndFunction(object)
Initializes a new instance with the function runtime
Declaration
public ReportEndFunction(object runtime)
Parameters
| Type | Name | Description |
|---|---|---|
| object | runtime | The runtime |
ReportEndFunction(string)
New function instance without runtime (scripting development)
Declaration
public ReportEndFunction(string sourceFileName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceFileName | The name of the source file |
Properties
View SourceDataSet
The report data set
Declaration
public DataSet DataSet { get; }
Property Value
| Type | Description |
|---|---|
| DataSet |
Tables
The report data tables
Declaration
public DataTableCollection Tables { get; }
Property Value
| Type | Description |
|---|---|
| DataTableCollection |
Methods
View SourceAddRelation(string, string, string, string)
Add relation between two table
Declaration
public DataRelation AddRelation(string relationName, string parentTableName, string childTableName, string childColumnName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | relationName | The relation name |
| string | parentTableName | The relation parent table name |
| string | childTableName | The relation child table name |
| string | childColumnName | The relation child table column name |
Returns
| Type | Description |
|---|---|
| DataRelation |
AddRelation(string, string, string, string, string)
Add relation between two table
Declaration
public DataRelation AddRelation(string relationName, string parentTableName, string parentColumnName, string childTableName, string childColumnName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | relationName | The relation name |
| string | parentTableName | The relation parent table name |
| string | parentColumnName | The relation parent table column name |
| string | childTableName | The relation child table name |
| string | childColumnName | The relation child table column name |
Returns
| Type | Description |
|---|---|
| DataRelation |
AddTable(DataTable)
Add a table to the data set
Declaration
public void AddTable(DataTable table)
Parameters
| Type | Name | Description |
|---|---|---|
| DataTable | table | The table |
AddTable(string)
Add a table to the data set
Declaration
public DataTable AddTable(string tableName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | tableName | Name of the table |
Returns
| Type | Description |
|---|---|
| DataTable |
Compute(string, string, string)
Computes the given expression on the current rows that pass the filter criteria
Declaration
public object Compute(string tableName, string expression, string filter = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | tableName | Name of the table |
| string | expression | The expression to compute |
| string | filter | The filter to limit the rows that evaluate in the expression |
Returns
| Type | Description |
|---|---|
| object | An Object, set to the result of the computation. If the expression evaluates to null, the return value will be Value |
Compute<T>(string, string, string)
Computes the given expression on the current rows that pass the filter criteria
Declaration
public T Compute<T>(string tableName, string expression, string filter = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | tableName | Name of the table |
| string | expression | The expression to compute |
| string | filter | The filter to limit the rows that evaluate in the expression |
Returns
| Type | Description |
|---|---|
| T | An Object, set to the result of the computation. If the expression evaluates to null, the return value will be Value |
Type Parameters
| Name | Description |
|---|---|
| T |
ContainsTable(string)
Determines whether the table contains the specified table
Declaration
public bool ContainsTable(string tableName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | tableName | Name of the table |
Returns
| Type | Description |
|---|---|
| bool | True for an existing table |
End()
Entry point for the runtime
Declaration
public object End()
Returns
| Type | Description |
|---|---|
| object |
Remarks
Internal usage only, do not call this method
ExecuteMergeQuery(string, string, string, Dictionary<string, string>, DataMergeSchemaChange)
Execute a query on the Api web method and merge the table to the set
Declaration
public DataTable ExecuteMergeQuery(string tableName, string methodName, string mergeColumn, Dictionary<string, string> parameters = null, DataMergeSchemaChange schemaChange = DataMergeSchemaChange.Add)
Parameters
| Type | Name | Description |
|---|---|---|
| string | tableName | Target table name |
| string | methodName | The query name |
| string | mergeColumn | The column used to merge (primary key column) |
| Dictionary<string, string> | parameters | The method parameters |
| DataMergeSchemaChange | schemaChange | Action to take when the required data column is missing |
Returns
| Type | Description |
|---|---|
| DataTable | New or expanded data table |
ExecuteMergeQuery(string, string, string, string, Dictionary<string, string>, DataMergeSchemaChange)
Execute a query on the Api web method and merge the table to the set
Declaration
public DataTable ExecuteMergeQuery(string tableName, string methodName, string culture, string mergeColumn, Dictionary<string, string> parameters = null, DataMergeSchemaChange schemaChange = DataMergeSchemaChange.Add)
Parameters
| Type | Name | Description |
|---|---|---|
| string | tableName | Target table name |
| string | methodName | The query name |
| string | culture | The content culture |
| string | mergeColumn | The column used to merge (primary key column) |
| Dictionary<string, string> | parameters | The method parameters |
| DataMergeSchemaChange | schemaChange | Action to take when the required data column is missing |
Returns
| Type | Description |
|---|---|
| DataTable | New or expanded data table |
ExecuteResultQuery(string, Dictionary<string, string>)
Execute a query on the Api web method, table name extracted from method name
Declaration
public DataTable ExecuteResultQuery(string methodName, Dictionary<string, string> parameters = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | methodName | The query name |
| Dictionary<string, string> | parameters | The method parameters |
Returns
| Type | Description |
|---|---|
| DataTable | New data table, null on empty collection |
ExecuteResultQuery(string, string, Dictionary<string, string>)
Execute a query on the Api web method
Declaration
public DataTable ExecuteResultQuery(string tableName, string methodName, Dictionary<string, string> parameters = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | tableName | Target table name |
| string | methodName | The query name |
| Dictionary<string, string> | parameters | The method parameters |
Returns
| Type | Description |
|---|---|
| DataTable | New data table, null on empty collection |
ExecuteResultQuery(string, string, string, bool, Dictionary<string, string>)
Execute a result query on the Api web method
Declaration
public DataTable ExecuteResultQuery(string tableName, string methodName, string culture, bool resultQuery, Dictionary<string, string> parameters = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | tableName | Target table name |
| string | methodName | The query name |
| string | culture | The content culture |
| bool | resultQuery | Add query table to the data set |
| Dictionary<string, string> | parameters | The method parameters |
Returns
| Type | Description |
|---|---|
| DataTable | New data table, null on empty collection |
RemoveTable(string)
Remove a table from the data set
Declaration
public void RemoveTable(string tableName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | tableName | Name of the table |
RemoveTables(params string[])
Remove multiple tables from the data set
Declaration
public void RemoveTables(params string[] tableNames)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | tableNames | Name of the tables |