Show / Hide Table of Contents

Class ReportBuildFunction

Configures the report before it is executed: populates parameter lists, sets defaults, and controls parameter visibility.

Inheritance
object
Function
ReportFunction
ReportBuildFunction
Implements
IDisposable
Inherited Members
ReportFunction.GetReportAttribute(string)
ReportFunction.GetReportAttribute<T>(string, T)
ReportFunction.SetReportAttribute(string, object)
ReportFunction.HasParameter(string)
ReportFunction.GetParameter(string)
ReportFunction.GetParameter<T>(string, T)
ReportFunction.GetParameterAttribute(string, string)
ReportFunction.GetParameterAttribute<T>(string, string, T)
ReportFunction.SetParameterAttribute(string, string, object)
ReportFunction.ParameterHidden(string)
ReportFunction.AddReportLog(string, string, DateTime?)
ReportFunction.ToReportMessage(string)
ReportFunction.ExecuteQuery(string, string, Dictionary<string, string>)
ReportFunction.ExecuteQuery(string, string, string, Dictionary<string, string>)
ReportFunction.ExecuteQuery(string, Dictionary<string, string>)
ReportFunction.ExecuteDivisionQuery(int)
ReportFunction.ExecutePayrollDivisionIdQuery(int)
ReportFunction.ExecutePayrollDivisionQuery(int)
ReportFunction.ExecuteLookupValueQuery(int, string, string, string)
ReportFunction.ExecuteGlobalCaseValueQuery(string, ReportQuery)
ReportFunction.ExecuteNationalCaseValueQuery(string, ReportQuery)
ReportFunction.ExecuteCompanyCaseValueQuery(string, ReportQuery)
ReportFunction.ExecuteEmployeeCaseValueQuery(string, int, ReportQuery)
ReportFunction.ExecuteWageTypeQuery(string, int, ReportQuery)
ReportFunction.ExecutePayrollResultQuery(string, ReportQuery)
ReportFunction.ExecuteWageTypeResultQuery(string, int, ReportQuery)
ReportFunction.ExecuteWageTypeCustomResultQuery(string, int, int, ReportQuery)
ReportFunction.ExecuteCollectorResultQuery(string, int, ReportQuery)
ReportFunction.ExecuteCollectorCustomResultQuery(string, int, int, ReportQuery)
ReportFunction.ExecutePayrunResultQuery(string, int, ReportQuery)
ReportFunction.GetOperationBaseName(string)
ReportFunction.ExecuteValueQuery<T>(string, string, Dictionary<string, string>)
ReportFunction.ExecuteValueQuery<T>(string, string, Dictionary<string, string>, T)
ReportFunction.ExecuteLookupQuery(int, string, string, DateTime?, DateTime?)
ReportFunction.ExecuteLookupQuery(int, IEnumerable<string>, string, DateTime?, DateTime?)
ReportFunction.ExecuteCaseFieldQuery(int, IEnumerable<string>, string, DateTime?, DateTime?)
ReportFunction.ExecuteEmployeeTimeCaseValueQuery(string, int, IEnumerable<int>, IEnumerable<CaseValueColumn>, string, DateTime?, DateTime?, DateTime?)
ReportFunction.ExecuteRawCaseValueQuery(string, int, IEnumerable<string>, DatePeriod, DateTime?, DateTime?)
ReportFunction.ExecuteRawCaseValueQuery(string, int, int, IEnumerable<string>, DatePeriod, DateTime?, DateTime?)
ReportFunction.ExecuteRawCaseValueQuery(string, int, IEnumerable<string>, DateTime?, DateTime?, DateTime?, DateTime?)
ReportFunction.ExecuteRawCaseValueQuery(string, int, int, IEnumerable<string>, DateTime?, DateTime?, DateTime?, DateTime?)
ReportFunction.ResolveParameterUserId()
ReportFunction.ResolveParameterEmployeeId()
ReportFunction.ResolveParameterRegulationId()
ReportFunction.ResolveParameterPayrollId()
ReportFunction.ResolveParameterPayrunId()
ReportFunction.ResolveIdentifierParameter(string, string)
ReportFunction.ResolveNameParameter(string, string)
ReportFunction.AddInfo(string, object)
ReportFunction.RemoveInfo(string)
ReportFunction.ReportName
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 class ReportBuildFunction : ReportFunction, IDisposable
Remarks

This function runs when the user opens a report to prepare the parameter form. It is called every time the form is refreshed. Use it to dynamically populate drop-down lists, pre-select defaults, and show or hide parameters based on other parameter values or the user context.

Key capabilities:

  • Set a parameter value: SetParameter(string, string) / SetParameter<T>(string, T).
  • Show/hide parameters: ShowParameter(params string[]) / HideParameter(params string[]). Use SetParameterReadOnly(string, bool) to make a single-option parameter non-editable.
  • Populate a list: ExecuteInputListQuery(string, Dictionary<string, string>, string, Func<DataRow, object>, Func<DataRow, string>, Func<List<object>, object>) queries the API and sets the List and ListValues parameter attributes in one call. BuildInputList(DataTable, string, Func<DataRow, object>, Func<DataRow, string>, Func<List<object>, object>) does the same from an already-fetched DataTable.
  • Mark as invalid: BuildInvalid() blocks report execution (e.g. when a required lookup is missing).

Return value: Return null to indicate a successful build and allow the user to edit parameters. Return false to mark the report as not buildable.

For queries, data assembly, and result post-processing see ReportStartFunction and ReportEndFunction.

Examples
// Resolve the payroll id from the PayrollId parameter, then build an employee list
var payrollId = ResolveParameterPayrollId() ?? 0;
ExecuteInputListQuery(
    "QueryEmployees",
    new QueryParameters()
        .ActiveStatus()
        .Parameter("TenantId", TenantId)
        .Parameter("PayrollId", payrollId),
    "EmployeeId",
    row => row.GetValue<int>("EmployeeId"),
    row => row.GetValue<string>("LastName") + ", " + row.GetValue<string>("FirstName"));
// Hide a parameter when only one payroll exists
var payrollId = ResolveParameterPayrollId();
if (payrollId.HasValue)
    HideParameter("PayrollId");

Constructors

View Source

ReportBuildFunction(object)

Initializes a new instance with the function runtime

Declaration
public ReportBuildFunction(object runtime)
Parameters
Type Name Description
object runtime

The runtime

View Source

ReportBuildFunction(string)

New function instance without runtime (scripting development)

Declaration
public ReportBuildFunction(string sourceFileName)
Parameters
Type Name Description
string sourceFileName

The name of the source file

Methods

View Source

Build()

Entry point for the runtime

Declaration
public bool? Build()
Returns
Type Description
bool?
Remarks

Internal usage only, do not call this method

View Source

BuildInputList(DataTable, string, Func<DataRow, object>, Func<DataRow, string>, Func<List<object>, object>)

Build report parameter input list

Declaration
public List<object> BuildInputList(DataTable table, string reportParameter, Func<DataRow, object> identifierFunc, Func<DataRow, string> displayFunc = null, Func<List<object>, object> selectFunc = null)
Parameters
Type Name Description
DataTable table

List data table

string reportParameter

Report parameter name

Func<DataRow, object> identifierFunc

Identifier function

Func<DataRow, string> displayFunc

Display function: return null to use the identifier for display

Func<List<object>, object> selectFunc

Selection function: return the selected identifier or null

Returns
Type Description
List<object>

List of identifiers, selected by the identifier function

Remarks

Use the query order-by for sorting

View Source

BuildInvalid()

Set report build to invalid

Declaration
public void BuildInvalid()
View Source

BuildValid()

Set report build to valid

Declaration
public void BuildValid()
View Source

BuildValidity(bool)

Set report build validity

Declaration
public void BuildValidity(bool valid)
Parameters
Type Name Description
bool valid

Build validity

View Source

ExecuteInputListQuery(string, Dictionary<string, string>, string, Func<DataRow, object>, Func<DataRow, string>, Func<List<object>, object>)

Build report parameter input list based on query

Declaration
public List<object> ExecuteInputListQuery(string queryMethod, Dictionary<string, string> queryParameters, string reportParameter, Func<DataRow, object> identifierFunc, Func<DataRow, string> displayFunc = null, Func<List<object>, object> selectFunc = null)
Parameters
Type Name Description
string queryMethod

Query method name

Dictionary<string, string> queryParameters

Query parameters

string reportParameter

Report parameter name

Func<DataRow, object> identifierFunc

Identifier function

Func<DataRow, string> displayFunc

Display function: return null to use the identifier for display

Func<List<object>, object> selectFunc

Selection function: return the selected identifier or null

Returns
Type Description
List<object>

List of identifiers, selected by the identifier function

Remarks

Use the query order-by for sorting

View Source

HideParameter(params string[])

Hide report parameter

Declaration
public void HideParameter(params string[] parameterNames)
Parameters
Type Name Description
string[] parameterNames

The parameter name

View Source

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

View Source

SetParameterHidden(string, bool)

Set the report parameter hidden state

Declaration
public void SetParameterHidden(string parameterName, bool hidden)
Parameters
Type Name Description
string parameterName

The parameter name

bool hidden

The hidden state

View Source

SetParameterReadOnly(string, bool)

Set the report parameter read-only state

Declaration
public void SetParameterReadOnly(string parameterName, bool readOnly)
Parameters
Type Name Description
string parameterName

The parameter name

bool readOnly

The read-only state

View Source

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
View Source

ShowParameter(params string[])

Show report parameters

Declaration
public void ShowParameter(params string[] parameterNames)
Parameters
Type Name Description
string[] parameterNames

The parameter names

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)

See Also

ReportStartFunction
ReportEndFunction
  • View Source
☀
☾
Back to top Generated by DocFX