Show / Hide Table of Contents

Class ReportFunction

Abstract base class for report functions, providing access to the report name, parameters, attributes, API query execution, lookup resolution, and case value retrieval.

Inheritance
object
Function
ReportFunction
ReportBuildFunction
ReportEndFunction
ReportStartFunction
Implements
IDisposable
Inherited Members
Function.GetTenantAttribute(string)
Function.GetTenantAttribute<T>(string, T)
Function.GetUserAttribute(string)
Function.GetUserAttribute<T>(string, T)
Function.GetDerivedCulture(int, int)
Function.GetDerivedCalendar(int, int)
Function.GetCalendarDayCount(DateTime, DateTime, string)
Function.GetCalendarDayCount(string, DateTime, DateTime, string)
Function.IsCalendarWorkDay(string, DateTime?)
Function.IsCalendarWorkDay(DateTime?)
Function.GetPreviousWorkDay(string, DateTime?)
Function.GetPreviousWorkDays(string, DateTime?, int)
Function.GetNextWorkDay(string, DateTime?)
Function.GetNextWorkDays(string, DateTime?, int)
Function.GetCalendarPeriod(DateTime?, int, int, int)
Function.GetCalendarPeriod(string, DateTime?, int, string)
Function.LogVerbose(string, string, string)
Function.LogDebug(string, string, string)
Function.LogInformation(string, string, string)
Function.LogWarning(string, string, string)
Function.LogError(string, string, string)
Function.LogError(Exception, string, string)
Function.LogFatal(string, string, string)
Function.LogFatal(Exception, string, string)
Function.Log(LogLevel, string, string, string)
Function.AddTask(string, string, DateTime, string, Dictionary<string, object>)
Function.InvokeWebhook<T>(string, object)
Function.GetSourceFileName(string)
Function.ChangeValueType<T>(object, T, IFormatProvider)
Function.Dispose()
Function.Runtime
Function.TenantId
Function.TenantIdentifier
Function.UserId
Function.UserIdentifier
Function.UserCulture
Function.UserType
Function.SelfServiceUser
Function.AdminUser
Function.SourceFileName
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: PayrollEngine.Client.Scripting.Function
Assembly: PayrollEngine.Client.Scripting.dll
Syntax
public abstract class ReportFunction : Function, IDisposable
Remarks

This class is the common ancestor of the three report lifecycle functions:

  • ReportBuildFunction — configures the parameter form before the report is executed.
  • ReportStartFunction — prepares queries and parameters at execution start.
  • ReportEndFunction — post-processes the assembled data set.

Parameters: HasParameter(string) / GetParameter<T>(string, T) read user-supplied report inputs. GetParameterAttribute<T>(string, string, T) accesses parameter-level metadata such as input-list definitions. ParameterHidden(string) tests visibility.

Attributes: GetReportAttribute<T>(string, T) / SetReportAttribute(string, object) read and write report-scoped key/value metadata that persists across build/start/end phases.

Query execution: ExecuteQuery(string, string, string, Dictionary<string, string>) calls REST API endpoints and returns results as a DataTable. Specialised overloads cover global/national/company/employee case values, wage type results, collector results, and payrun results.

Lookup resolution: ExecuteLookupQuery(int, string, string, DateTime?, DateTime?) returns a key/value dictionary for a named lookup, suitable for code-to-label translation in reports.

Parameter resolution helpers: ResolveParameterEmployeeId(), ResolveParameterPayrollId(), ResolveParameterRegulationId(), etc. accept either an integer id or a name/identifier string and resolve to the canonical object id.

Constructors

View Source

ReportFunction(object)

Initializes a new instance with the function runtime

Declaration
protected ReportFunction(object runtime)
Parameters
Type Name Description
object runtime

The runtime

View Source

ReportFunction(string)

New function instance without runtime (scripting development)

Declaration
protected ReportFunction(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 Source

ReportName

Gets the report name

Declaration
public string ReportName { get; }
Property Value
Type Description
string

Methods

View Source

AddInfo(string, object)

Adds or updates a named entry in the report's edit-info attribute

Declaration
public void AddInfo(string name, object value)
Parameters
Type Name Description
string name

The info entry name

object value

The info entry value

View Source

AddReportLog(string, string, DateTime?)

Add report log

Declaration
public void AddReportLog(string message, string key = null, DateTime? reportDate = null)
Parameters
Type Name Description
string message

The log message

string key

The log key

DateTime? reportDate

The report date (default: now)

View Source

ExecuteCaseFieldQuery(int, IEnumerable<string>, string, DateTime?, DateTime?)

Get payroll case fields

Declaration
public DataTable ExecuteCaseFieldQuery(int payrollId, IEnumerable<string> caseFieldNames = null, string clusterSetName = null, DateTime? regulationDate = null, DateTime? evaluationDate = null)
Parameters
Type Name Description
int payrollId

The payroll id

IEnumerable<string> caseFieldNames

The case field names

string clusterSetName

The cluster set

DateTime? regulationDate

The regulation date

DateTime? evaluationDate

The evaluation date

Returns
Type Description
DataTable

Payroll case fields

View Source

ExecuteCollectorCustomResultQuery(string, int, int, ReportQuery)

Query collector custom results

Declaration
public DataTable ExecuteCollectorCustomResultQuery(string tableName, int payrollResultId, int collectorResultId, ReportQuery query = null)
Parameters
Type Name Description
string tableName

Target table name

int payrollResultId

The payroll result id

int collectorResultId

The collector result id

ReportQuery query

The query

Returns
Type Description
DataTable

Collector custom result data table, null on empty collection

View Source

ExecuteCollectorResultQuery(string, int, ReportQuery)

Query collector results

Declaration
public DataTable ExecuteCollectorResultQuery(string tableName, int payrollResultId, ReportQuery query = null)
Parameters
Type Name Description
string tableName

Target table name

int payrollResultId

The payroll result id

ReportQuery query

The query

Returns
Type Description
DataTable

Collector result data table, null on empty collection

View Source

ExecuteCompanyCaseValueQuery(string, ReportQuery)

Queries company case values and returns the result as a data table

Declaration
public DataTable ExecuteCompanyCaseValueQuery(string tableName, ReportQuery query = null)
Parameters
Type Name Description
string tableName

Target table name

ReportQuery query

Optional query filter

Returns
Type Description
DataTable

Data table containing the matching case value rows

View Source

ExecuteDivisionQuery(int)

Query the division by id

Declaration
public DataTable ExecuteDivisionQuery(int divisionId)
Parameters
Type Name Description
int divisionId

The division id

Returns
Type Description
DataTable

Single row table

View Source

ExecuteEmployeeCaseValueQuery(string, int, ReportQuery)

Queries case values for a specific employee and returns the result as a data table

Declaration
public DataTable ExecuteEmployeeCaseValueQuery(string tableName, int employeeId, ReportQuery query = null)
Parameters
Type Name Description
string tableName

Target table name

int employeeId

The employee id

ReportQuery query

Optional query filter

Returns
Type Description
DataTable

Data table containing the matching case value rows

View Source

ExecuteEmployeeTimeCaseValueQuery(string, int, IEnumerable<int>, IEnumerable<CaseValueColumn>, string, DateTime?, DateTime?, DateTime?)

Get employees case values as table. Table structure: first column is the employee id, and for any case field a column

Declaration
public DataTable ExecuteEmployeeTimeCaseValueQuery(string tableName, int payrollId, IEnumerable<int> employeeIds, IEnumerable<CaseValueColumn> columns, string culture, DateTime? valueDate = null, DateTime? regulationDate = null, DateTime? evaluationDate = null)
Parameters
Type Name Description
string tableName

The table name

int payrollId

The payroll id

IEnumerable<int> employeeIds

The employee ids

IEnumerable<CaseValueColumn> columns

The table columns

string culture

The culture

DateTime? valueDate

The value date

DateTime? regulationDate

The regulation date

DateTime? evaluationDate

The evaluation date

Returns
Type Description
DataTable

Employees case values

View Source

ExecuteGlobalCaseValueQuery(string, ReportQuery)

Queries global case values and returns the result as a data table

Declaration
public DataTable ExecuteGlobalCaseValueQuery(string tableName, ReportQuery query = null)
Parameters
Type Name Description
string tableName

Target table name

ReportQuery query

Optional query filter

Returns
Type Description
DataTable

Data table containing the matching case value rows

View Source

ExecuteLookupQuery(int, IEnumerable<string>, string, DateTime?, DateTime?)

Get lookup values, grouped by lookup

Declaration
public Dictionary<string, Dictionary<string, string>> ExecuteLookupQuery(int payrollId, IEnumerable<string> lookupNames, string culture, DateTime? regulationDate = null, DateTime? evaluationDate = null)
Parameters
Type Name Description
int payrollId

The payroll id

IEnumerable<string> lookupNames

The lookup names

string culture

The culture

DateTime? regulationDate

The regulation date

DateTime? evaluationDate

The evaluation date

Returns
Type Description
Dictionary<string, Dictionary<string, string>>

Lookup values dictionary by lookup name, value is a key/value dictionary

View Source

ExecuteLookupQuery(int, string, string, DateTime?, DateTime?)

Returns a key/value dictionary for a single named lookup

Declaration
public Dictionary<string, string> ExecuteLookupQuery(int payrollId, string lookupName, string culture, DateTime? regulationDate = null, DateTime? evaluationDate = null)
Parameters
Type Name Description
int payrollId

The payroll id

string lookupName

The lookup name

string culture

The culture used for localised values

DateTime? regulationDate

The regulation date (default: UTC now)

DateTime? evaluationDate

The evaluation date (default: UTC now)

Returns
Type Description
Dictionary<string, string>

Dictionary mapping lookup keys to their string values; empty if the lookup is not found

Examples
var lookup = ExecuteLookupQuery(payrollId, "TaxRates", UserCulture);
var rate = lookup["Standard"];
View Source

ExecuteLookupValueQuery(int, string, string, string)

Query Json lookup values by lookup name

Declaration
public Dictionary<string, string> ExecuteLookupValueQuery(int regulationId, string lookupName, string keyAttribute, string valueAttribute)
Parameters
Type Name Description
int regulationId

The regulation id

string lookupName

The lookup name

string keyAttribute

The json object key attribute name

string valueAttribute

The json object value attribute name

Returns
Type Description
Dictionary<string, string>

The lookup values dictionary

View Source

ExecuteNationalCaseValueQuery(string, ReportQuery)

Queries national case values and returns the result as a data table

Declaration
public DataTable ExecuteNationalCaseValueQuery(string tableName, ReportQuery query = null)
Parameters
Type Name Description
string tableName

Target table name

ReportQuery query

Optional query filter

Returns
Type Description
DataTable

Data table containing the matching case value rows

View Source

ExecutePayrollDivisionIdQuery(int)

Query the regulation id from the parameter RegulationId

Declaration
public int? ExecutePayrollDivisionIdQuery(int payrollId)
Parameters
Type Name Description
int payrollId

The payroll id

Returns
Type Description
int?

The regulation id, null for unknown regulation

View Source

ExecutePayrollDivisionQuery(int)

Query the regulation id from the parameter RegulationId

Declaration
public DataTable ExecutePayrollDivisionQuery(int payrollId)
Parameters
Type Name Description
int payrollId

The payroll id

Returns
Type Description
DataTable

Single row table

View Source

ExecutePayrollResultQuery(string, ReportQuery)

Query payroll results

Declaration
public DataTable ExecutePayrollResultQuery(string tableName, ReportQuery query = null)
Parameters
Type Name Description
string tableName

Target table name

ReportQuery query

The query

Returns
Type Description
DataTable

Payroll result data table, null on empty collection

View Source

ExecutePayrunResultQuery(string, int, ReportQuery)

Query payrun results

Declaration
public DataTable ExecutePayrunResultQuery(string tableName, int payrollResultId, ReportQuery query = null)
Parameters
Type Name Description
string tableName

Target table name

int payrollResultId

The payroll result id

ReportQuery query

The query

Returns
Type Description
DataTable

Payrun result data table, null on empty collection

View Source

ExecuteQuery(string, Dictionary<string, string>)

Execute a query on the Api web method, table name extracted from method name

Declaration
public DataTable ExecuteQuery(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

View Source

ExecuteQuery(string, string, Dictionary<string, string>)

Query on Api web method with the user culture

Declaration
public DataTable ExecuteQuery(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

View Source

ExecuteQuery(string, string, string, Dictionary<string, string>)

Query on Api web method

Declaration
public DataTable ExecuteQuery(string tableName, string methodName, string culture, Dictionary<string, string> parameters = null)
Parameters
Type Name Description
string tableName

Target table name

string methodName

The query name

string culture

The content culture

Dictionary<string, string> parameters

The method parameters

Returns
Type Description
DataTable

New data table, null on empty collection

View Source

ExecuteRawCaseValueQuery(string, int, IEnumerable<string>, DatePeriod, DateTime?, DateTime?)

Execute case value query on period

Declaration
public DataTable ExecuteRawCaseValueQuery(string tableName, int payrollId, IEnumerable<string> caseFieldNames, DatePeriod period, DateTime? regulationDate = null, DateTime? evaluationDate = null)
Parameters
Type Name Description
string tableName

Table name

int payrollId

Payroll id

IEnumerable<string> caseFieldNames

The case field names

DatePeriod period

Value period

DateTime? regulationDate

The regulation date (default: UTC now)

DateTime? evaluationDate

The evaluation date (default: UTC now)

Returns
Type Description
DataTable

Data table including for any case filed a column

View Source

ExecuteRawCaseValueQuery(string, int, IEnumerable<string>, DateTime?, DateTime?, DateTime?, DateTime?)

Execute case value query

Declaration
public DataTable ExecuteRawCaseValueQuery(string tableName, int payrollId, IEnumerable<string> caseFieldNames, DateTime? periodStart = null, DateTime? periodEnd = null, DateTime? regulationDate = null, DateTime? evaluationDate = null)
Parameters
Type Name Description
string tableName

Table name

int payrollId

Payroll id

IEnumerable<string> caseFieldNames

The case field names

DateTime? periodStart

Value period start date

DateTime? periodEnd

Value period end date

DateTime? regulationDate

The regulation date (default: UTC now)

DateTime? evaluationDate

The evaluation date (default: UTC now)

Returns
Type Description
DataTable

Data table including for any case filed a column

View Source

ExecuteRawCaseValueQuery(string, int, int, IEnumerable<string>, DatePeriod, DateTime?, DateTime?)

Execute employee case value query on period

Declaration
public DataTable ExecuteRawCaseValueQuery(string tableName, int payrollId, int employeeId, IEnumerable<string> caseFieldNames, DatePeriod period, DateTime? regulationDate = null, DateTime? evaluationDate = null)
Parameters
Type Name Description
string tableName

Table name

int payrollId

Payroll id

int employeeId

Employee id

IEnumerable<string> caseFieldNames

The case field names

DatePeriod period

Value period

DateTime? regulationDate

The regulation date (default: UTC now)

DateTime? evaluationDate

The evaluation date (default: UTC now)

Returns
Type Description
DataTable

Data table including for any case filed a column

View Source

ExecuteRawCaseValueQuery(string, int, int, IEnumerable<string>, DateTime?, DateTime?, DateTime?, DateTime?)

Execute employee case value query

Declaration
public DataTable ExecuteRawCaseValueQuery(string tableName, int payrollId, int employeeId, IEnumerable<string> caseFieldNames, DateTime? startDate = null, DateTime? endDate = null, DateTime? regulationDate = null, DateTime? evaluationDate = null)
Parameters
Type Name Description
string tableName

Table name

int payrollId

Payroll id

int employeeId

Employee id

IEnumerable<string> caseFieldNames

The case field names

DateTime? startDate

Value period start date

DateTime? endDate

Value period end date

DateTime? regulationDate

The regulation date (default: UTC now)

DateTime? evaluationDate

The evaluation date (default: UTC now)

Returns
Type Description
DataTable

Data table including for any case filed a column

View Source

ExecuteValueQuery<T>(string, string, Dictionary<string, string>)

Execute a value query on the Api web method

Declaration
public T ExecuteValueQuery<T>(string methodName, string attributeName, Dictionary<string, string> parameters)
Parameters
Type Name Description
string methodName

The query name

string attributeName

Name of the attribute

Dictionary<string, string> parameters

The method parameters

Returns
Type Description
T

Resulting data table, existing will be removed

Type Parameters
Name Description
T
View Source

ExecuteValueQuery<T>(string, string, Dictionary<string, string>, T)

Executes a scalar query on the API and returns a typed value with a fallback

Declaration
public T ExecuteValueQuery<T>(string methodName, string attributeName, Dictionary<string, string> parameters, T defaultValue)
Parameters
Type Name Description
string methodName

The query name

string attributeName

The column name to read from the single result row

Dictionary<string, string> parameters

The query parameters

T defaultValue

The value returned when the result is empty or has no matching row

Returns
Type Description
T

The typed column value, or defaultValue if no row exists

Type Parameters
Name Description
T
View Source

ExecuteWageTypeCustomResultQuery(string, int, int, ReportQuery)

Query wage type custom results

Declaration
public DataTable ExecuteWageTypeCustomResultQuery(string tableName, int payrollResultId, int wageTypeResultId, ReportQuery query = null)
Parameters
Type Name Description
string tableName

Target table name

int payrollResultId

The payroll result id

int wageTypeResultId

The wage type result id

ReportQuery query

The query

Returns
Type Description
DataTable

Wage type custom result data table, null on empty collection

View Source

ExecuteWageTypeQuery(string, int, ReportQuery)

Query regulation wage

Declaration
public DataTable ExecuteWageTypeQuery(string tableName, int regulationId, ReportQuery query = null)
Parameters
Type Name Description
string tableName

Target table name

int regulationId

The regulation id

ReportQuery query

The query

Returns
Type Description
DataTable

Wage type data table, null on empty collection

View Source

ExecuteWageTypeResultQuery(string, int, ReportQuery)

Query wage type results

Declaration
public DataTable ExecuteWageTypeResultQuery(string tableName, int payrollResultId, ReportQuery query = null)
Parameters
Type Name Description
string tableName

Target table name

int payrollResultId

The payroll result id

ReportQuery query

The query

Returns
Type Description
DataTable

Wage type result data table, null on empty collection

View Source

GetOperationBaseName(string)

Get operation base name

Declaration
public static string GetOperationBaseName(string operation)
Parameters
Type Name Description
string operation

The operation name

Returns
Type Description
string

Operation base name

View Source

GetParameter(string)

Get report parameter

Declaration
public string GetParameter(string parameterName)
Parameters
Type Name Description
string parameterName

The parameter name

Returns
Type Description
string

The report parameter value as JSON

View Source

GetParameterAttribute(string, string)

Get report parameter attribute value

Declaration
public object GetParameterAttribute(string parameterName, string attributeName)
Parameters
Type Name Description
string parameterName

The parameter name

string attributeName

Name of the attribute

Returns
Type Description
object

The report attribute value

View Source

GetParameterAttribute<T>(string, string, T)

Gets a report parameter attribute as a typed value

Declaration
public T GetParameterAttribute<T>(string parameterName, string attributeName, T defaultValue = default)
Parameters
Type Name Description
string parameterName

The parameter name

string attributeName

Name of the attribute

T defaultValue

The default value

Returns
Type Description
T

The parameter attribute value cast to T

Type Parameters
Name Description
T

The target value type

View Source

GetParameter<T>(string, T)

Get report parameter typed value

Declaration
public T GetParameter<T>(string parameterName, T defaultValue = default)
Parameters
Type Name Description
string parameterName

The parameter name

T defaultValue

The default value

Returns
Type Description
T

The report parameter value

Type Parameters
Name Description
T
View Source

GetReportAttribute(string)

Get report attribute value

Declaration
public object GetReportAttribute(string attributeName)
Parameters
Type Name Description
string attributeName

Name of the attribute

Returns
Type Description
object

The report attribute value

View Source

GetReportAttribute<T>(string, T)

Gets a report attribute as a typed value

Declaration
public T GetReportAttribute<T>(string attributeName, T defaultValue = default)
Parameters
Type Name Description
string attributeName

Name of the attribute

T defaultValue

The default value

Returns
Type Description
T

The report attribute value cast to T

Type Parameters
Name Description
T

The target value type

View Source

HasParameter(string)

Check for existing report parameter

Declaration
public bool HasParameter(string parameterName)
Parameters
Type Name Description
string parameterName

The parameter name

Returns
Type Description
bool
View Source

ParameterHidden(string)

Test for hidden report parameter

Declaration
public bool ParameterHidden(string parameterName)
Parameters
Type Name Description
string parameterName

The parameter name

Returns
Type Description
bool

True for hidden report attribute

View Source

RemoveInfo(string)

Removes a named entry from the report's edit-info attribute

Declaration
public void RemoveInfo(string name)
Parameters
Type Name Description
string name

The info entry name to remove

View Source

ResolveIdentifierParameter(string, string)

Resolve the object id from the identifier/id parameter

Declaration
public int? ResolveIdentifierParameter(string queryName, string parameterName)
Parameters
Type Name Description
string queryName

The query name

string parameterName

The parameter name

Returns
Type Description
int?

The object id, null for unknown payrun

View Source

ResolveNameParameter(string, string)

Resolves the object id from a report parameter that may contain an integer id or a name string

Declaration
public int? ResolveNameParameter(string queryName, string parameterName)
Parameters
Type Name Description
string queryName

The query name

string parameterName

The parameter name

Returns
Type Description
int?

The object id, null for unknown payrun

View Source

ResolveParameterEmployeeId()

Resolve the employee id from the parameter EmployeeId by id or identifier

Declaration
public int? ResolveParameterEmployeeId()
Returns
Type Description
int?

The employee id, null for unknown employee

View Source

ResolveParameterPayrollId()

Resolve the payroll id from the parameter PayrollId by id or name

Declaration
public int? ResolveParameterPayrollId()
Returns
Type Description
int?

The regulation id, null for unknown payroll

View Source

ResolveParameterPayrunId()

Resolve the payrun id from the parameter PayrunId by id or name

Declaration
public int? ResolveParameterPayrunId()
Returns
Type Description
int?

The regulation id, null for unknown payrun

View Source

ResolveParameterRegulationId()

Resolve the regulation id from the parameter RegulationId by id or name

Declaration
public int? ResolveParameterRegulationId()
Returns
Type Description
int?

The regulation id, null for unknown regulation

View Source

ResolveParameterUserId()

Resolve the user id from the parameter UserId by id or identifier

Declaration
public int? ResolveParameterUserId()
Returns
Type Description
int?

The employee id, null for unknown user

View Source

SetParameterAttribute(string, string, object)

Set report attribute value

Declaration
public void SetParameterAttribute(string parameterName, string attributeName, object value)
Parameters
Type Name Description
string parameterName

The parameter name

string attributeName

Name of the attribute

object value

The attribute value

View Source

SetReportAttribute(string, object)

Set report attribute value

Declaration
public void SetReportAttribute(string attributeName, object value)
Parameters
Type Name Description
string attributeName

Name of the attribute

object value

Attribute value

View Source

ToReportMessage(string)

Create report message

Declaration
public string ToReportMessage(string message)
Parameters
Type Name Description
string message

The error message

Returns
Type Description
string

Implements

IDisposable

Extension Methods

ConsoleExtensions.WriteProperties(object, bool)
ValueTypeExtensions.GetValueType(object)
ObjectInfo.GetPropertyValue(object, string)
ObjectInfo.GetPropertyValue<T>(object, string, T)
ObjectInfo.ResolvePropertyValue(object, string)
ObjectInfo.SetPropertyValue(object, string, object)
  • View Source
☀
☾
Back to top Generated by DocFX