Class ReportStartFunction
Executes at the start of report data collection, after parameters are finalized and before the data set is assembled.
Implements
Inherited Members
Namespace: PayrollEngine.Client.Scripting.Function
Assembly: PayrollEngine.Client.Scripting.dll
Syntax
public class ReportStartFunction : ReportFunction, IDisposable
Remarks
This function runs once per report execution, after ReportBuildFunction has configured the parameters and the user has confirmed the inputs. It is the primary hook for overriding parameter values programmatically and registering custom query strings that the report engine will use when populating the data set.
Typical uses:
- Derive or override parameter values based on other parameters (SetParameter<T>(string, T)).
- Register custom query strings via SetQuery(string, string) so the engine uses them when populating the data set tables.
- Validate parameter combinations and abort execution by returning
false.
Return value: Return null to proceed with data assembly.
Return false to abort the report before any data is fetched.
For parameter form setup see ReportBuildFunction. For post-processing the assembled data set see ReportEndFunction.
Examples
// Resolve a payroll id from the parameter and store the division for downstream use
var payrollId = ResolveParameterPayrollId() ?? 0;
var divisionId = ExecutePayrollDivisionIdQuery(payrollId);
SetParameter("DivisionId", divisionId);
Constructors
View SourceReportStartFunction(object)
Initializes a new instance with the function runtime
Declaration
public ReportStartFunction(object runtime)
Parameters
| Type | Name | Description |
|---|---|---|
| object | runtime | The runtime |
ReportStartFunction(string)
New function instance without runtime (scripting development)
Declaration
public ReportStartFunction(string sourceFileName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceFileName | The name of the source file |
Methods
View SourceGetQuery(string)
Get report query
Declaration
public string GetQuery(string queryName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | queryName | The query name |
Returns
| Type | Description |
|---|---|
| string | The report parameter value as JSON |
HasQuery(string)
Check for existing report query
Declaration
public bool HasQuery(string queryName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | queryName | The query name |
Returns
| Type | Description |
|---|---|
| bool |
SetParameter(string, string)
Set report parameter value
Declaration
public void SetParameter(string parameterName, string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | parameterName | The parameter name |
| string | value | The parameter value as JSON |
SetParameter<T>(string, T)
Set report parameter typed value
Declaration
public void SetParameter<T>(string parameterName, T value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | parameterName | The parameter name |
| T | value | The default value |
Type Parameters
| Name | Description |
|---|---|
| T |
SetQuery(string, string)
Set report query value as JSON
Declaration
public void SetQuery(string queryName, string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | queryName | The query name |
| string | value | The query value as JSON |
Start()
Entry point for the runtime
Declaration
public object Start()
Returns
| Type | Description |
|---|---|
| object |
Remarks
Internal usage only, do not call this method