Class CollectorApplyFunction
Controls how a wage type value is applied to the collector, and can modify or veto the amount.
Implements
Inherited Members
Namespace: PayrollEngine.Client.Scripting.Function
Assembly: PayrollEngine.Client.Scripting.dll
Syntax
public class CollectorApplyFunction : CollectorFunction, IDisposable
Remarks
This function is called every time a wage type feeds a value into this collector. The incoming wage type is identified by WageTypeNumber and WageTypeName; the amount to apply is WageTypeValue. The current accumulated state of the collector is available through the inherited CollectorSummary, CollectorCount, CollectorMinimum, and CollectorMaximum properties.
Typical uses:
- Cap the accumulated value: return a reduced amount once a threshold is reached.
- Filter by wage type: return
nullto prevent specific wage types from contributing. - Apply a floor: ensure the minimum contribution is never below a defined amount.
- Transform the value before accumulation (e.g. round to whole units).
Return value: Return the decimal value to accumulate into the collector.
Return null to skip the application entirely (the wage type contributes nothing).
Return Empty to produce an empty result for this application.
Low-Code / No-Code: Apply logic can be expressed through
CollectorApplyAction attributes. The GetValue() entry point invokes
all registered actions before the inline script body.
Examples
// Clamp the input: never apply more than 5 000
System.Math.Min(WageTypeValue, 5000m)
// Only collect from wage type 2250
WageTypeNumber == 2250 ? WageTypeValue : null
// Cap the collector total at 10 000
CollectorSummary + WageTypeValue > 10000m
? 10000m - CollectorSummary
: WageTypeValue
Constructors
View SourceCollectorApplyFunction(object)
Initializes a new instance with the function runtime
Declaration
public CollectorApplyFunction(object runtime)
Parameters
| Type | Name | Description |
|---|---|---|
| object | runtime | The runtime |
CollectorApplyFunction(string)
New function instance without runtime (scripting development)
Declaration
protected CollectorApplyFunction(string sourceFileName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceFileName | The name of the source file |
Remarks
Use GetSourceFileName(string) in your constructor for the source file name
Properties
View SourceWageTypeName
The wage type name
Declaration
[ActionProperty("Wage type name", null)]
public string WageTypeName { get; }
Property Value
| Type | Description |
|---|---|
| string |
WageTypeNumber
The wage type number
Declaration
[ActionProperty("Wage type number", null)]
public decimal WageTypeNumber { get; }
Property Value
| Type | Description |
|---|---|
| decimal |
WageTypeValue
The wage type result value
Declaration
[ActionProperty("Wage type value", null)]
public decimal WageTypeValue { get; }
Property Value
| Type | Description |
|---|---|
| decimal |
Methods
View SourceGetValue()
Entry point for the runtime
Declaration
public object GetValue()
Returns
| Type | Description |
|---|---|
| object |
Remarks
Internal usage only, do not call this method