Class CollectorFunction
Abstract base class for collector functions, providing access to collector state, statistics, result attributes, custom results, and retro payrun scheduling.
Inheritance
Implements
Inherited Members
Namespace: PayrollEngine.Client.Scripting.Function
Assembly: PayrollEngine.Client.Scripting.dll
Syntax
public abstract class CollectorFunction : PayrunFunction, IDisposable
Remarks
This class extends PayrunFunction with collector-specific facilities. It is the common ancestor of CollectorStartFunction, CollectorApplyFunction, and CollectorEndFunction.
Collector state:
- CollectorName — identifies the collector.
- CollectorResult — the current committed result value.
- CollectorSummary, CollectorCount, CollectorMinimum, CollectorMaximum, CollectorAverage — running statistics over all applied values.
- CollectorThreshold, CollectorMinResult, CollectorMaxResult — configured limits from the regulation definition.
- CollectMode — controls how values are accumulated (sum, replace, etc.).
- Negated — when
true, the collected value is negated before accumulation.
Cross-collector access: the Collector indexer reads the current value of another collector by name.
Result attributes: ResultAttribute / ResultAttributePayrollValue store metadata on the collector result for consumption by reports.
AddCustomResult(string, decimal, IEnumerable<string>, Dictionary<string, object>, ValueType?, string) and ScheduleRetroPayrun(DateTime, IEnumerable<string>) work identically to their counterparts in WageTypeFunction.
Constructors
View SourceCollectorFunction(object)
Initializes a new instance with the function runtime
Declaration
protected CollectorFunction(object runtime)
Parameters
| Type | Name | Description |
|---|---|---|
| object | runtime | The runtime |
CollectorFunction(string)
New function instance without runtime (scripting development)
Declaration
protected CollectorFunction(string sourceFileName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceFileName | The name of the source file |
Properties
View SourceCollectMode
The collect mode
Declaration
[ActionProperty("Collect mode", null)]
public string CollectMode { get; }
Property Value
| Type | Description |
|---|---|
| string |
Collector
Get a collector value by collector name
Declaration
public ScriptDictionary<string, decimal> Collector { get; }
Property Value
| Type | Description |
|---|---|
| ScriptDictionary<string, decimal> |
CollectorAverage
The average of the collected value
Declaration
[ActionProperty("Average of collected values", null)]
public decimal CollectorAverage { get; }
Property Value
| Type | Description |
|---|---|
| decimal |
CollectorCount
Collected values count
Declaration
[ActionProperty("Collected values count", null)]
public decimal CollectorCount { get; }
Property Value
| Type | Description |
|---|---|
| decimal |
CollectorGroups
The collector groups
Declaration
public string[] CollectorGroups { get; }
Property Value
| Type | Description |
|---|---|
| string[] |
CollectorMaxResult
The maximum allowed value
Declaration
[ActionProperty("Maximum allowed collector result", null)]
public decimal? CollectorMaxResult { get; }
Property Value
| Type | Description |
|---|---|
| decimal? |
CollectorMaximum
The maximum collected value
Declaration
[ActionProperty("Maximum collected value", null)]
public decimal CollectorMaximum { get; }
Property Value
| Type | Description |
|---|---|
| decimal |
CollectorMinResult
The minimum allowed value
Declaration
[ActionProperty("Minimum allowed collector result", null)]
public decimal? CollectorMinResult { get; }
Property Value
| Type | Description |
|---|---|
| decimal? |
CollectorMinimum
The minimum collected value
Declaration
[ActionProperty("Minimum collected value", null)]
public decimal CollectorMinimum { get; }
Property Value
| Type | Description |
|---|---|
| decimal |
CollectorName
The collector name
Declaration
[ActionProperty("Collector name", null)]
public string CollectorName { get; }
Property Value
| Type | Description |
|---|---|
| string |
CollectorResult
The current collector result
Declaration
[ActionProperty("Collector result value", null)]
public decimal CollectorResult { get; }
Property Value
| Type | Description |
|---|---|
| decimal |
CollectorSummary
The summary of the collected value
Declaration
[ActionProperty("Summary of collected values", null)]
public decimal CollectorSummary { get; }
Property Value
| Type | Description |
|---|---|
| decimal |
CollectorThreshold
The threshold value
Declaration
[ActionProperty("Threshold value", null)]
public decimal? CollectorThreshold { get; }
Property Value
| Type | Description |
|---|---|
| decimal? |
Negated
Negated collector result
Declaration
[ActionProperty("Test for negated collector", null)]
public bool Negated { get; }
Property Value
| Type | Description |
|---|---|
| bool |
ResultAttribute
Get or set a wage type result attribute value
Declaration
public ScriptDictionary<string, object> ResultAttribute { get; }
Property Value
| Type | Description |
|---|---|
| ScriptDictionary<string, object> |
ResultAttributePayrollValue
Get or set a wage type result attribute PayrollValue
Declaration
public ScriptDictionary<string, PayrollValue> ResultAttributePayrollValue { get; }
Property Value
| Type | Description |
|---|---|
| ScriptDictionary<string, PayrollValue> |
Methods
View SourceAddCustomResult(string, decimal, IEnumerable<string>, Dictionary<string, object>, ValueType?, string)
Adds a custom collector result, using the current period
Declaration
public void AddCustomResult(string source, decimal value, IEnumerable<string> tags = null, Dictionary<string, object> attributes = null, ValueType? valueType = null, string culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | source | The value source |
| decimal | value | The period value |
| IEnumerable<string> | tags | The result tags |
| Dictionary<string, object> | attributes | The collector custom result attributes |
| ValueType? | valueType | The result value type (numeric), default is the collector value type |
| string | culture | The result culture |
AddCustomResult(string, decimal, DateTime, DateTime, IEnumerable<string>, Dictionary<string, object>, ValueType?, string)
Adds a custom collector result
Declaration
public void AddCustomResult(string source, decimal value, DateTime startDate, DateTime endDate, IEnumerable<string> tags = null, Dictionary<string, object> attributes = null, ValueType? valueType = null, string culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | source | The value source |
| decimal | value | The period value |
| DateTime | startDate | The start date |
| DateTime | endDate | The end date |
| IEnumerable<string> | tags | The result tags |
| Dictionary<string, object> | attributes | The collector custom result attributes |
| ValueType? | valueType | The result value type (numeric), default is the collector value type |
| string | culture | The result culture |
GetCollectorAttribute(string)
Get attribute value
Declaration
public object GetCollectorAttribute(string attributeName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | attributeName | The attribute name |
Returns
| Type | Description |
|---|---|
| object |
GetCollectorAttribute<T>(string, T)
Get attribute typed value
Declaration
public T GetCollectorAttribute<T>(string attributeName, T defaultValue = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | attributeName | |
| T | defaultValue |
Returns
| Type | Description |
|---|---|
| T |
Type Parameters
| Name | Description |
|---|---|
| T |
GetCollectorCurrentConsolidatedValue(CollectorConsolidatedResultQuery)
Returns the sum of historical consolidated and current-period collector values for all collectors in the query
Declaration
public decimal GetCollectorCurrentConsolidatedValue(CollectorConsolidatedResultQuery query)
Parameters
| Type | Name | Description |
|---|---|---|
| CollectorConsolidatedResultQuery | query | The result query |
Returns
| Type | Description |
|---|---|
| decimal | Total of consolidated historical results plus the current in-memory collector values |
GetCollectorValue(string)
Get collector runtime result
Declaration
public decimal GetCollectorValue(string collectorName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | collectorName |
Returns
| Type | Description |
|---|---|
| decimal |
GetResultAttribute(string)
Get collector result attribute value
Declaration
public object GetResultAttribute(string attributeName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | attributeName |
Returns
| Type | Description |
|---|---|
| object |
GetResultTags()
Get the collector result tags
Declaration
public List<string> GetResultTags()
Returns
| Type | Description |
|---|---|
| List<string> | The collector result tags |
Reset()
Resets the collector to his initial state
Declaration
public void Reset()
ScheduleRetroPayrun(DateTime, IEnumerable<string>)
Schedule a retro payrun
Declaration
public void ScheduleRetroPayrun(DateTime scheduleDate, IEnumerable<string> resultTags = null)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTime | scheduleDate | The payrun schedule date, must be before the current period |
| IEnumerable<string> | resultTags | The result tags |
SetResultAttribute(string, object)
Set collector result attribute value
Declaration
public void SetResultAttribute(string attributeName, object value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | attributeName | |
| object | value |
SetResultTags(IEnumerable<string>)
Set the collector result tags
Declaration
public void SetResultTags(IEnumerable<string> tags)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<string> | tags | The result tags |