FunctionBase
Abstract base for all spreadsheet functions, defining evaluation logic, argument rules, and metadata for use in formula expressions.
Definition
Namespace:Telerik.Documents.Spreadsheet.Expressions.Functions
Assembly:Telerik.Windows.Documents.Spreadsheet.dll
Syntax:
public abstract class FunctionBase
Inheritance: objectFunctionBase
Derived Classes:
Constructors
Initializes a new function base instance, ready for evaluation in spreadsheet expressions.
protected FunctionBase()
Properties
Specifies how arguments are converted before evaluation, with a default of standard number function conversions including boolean-to-number mapping.
public virtual ArgumentConversionRules ArgumentConversionRules { get; }
The argument conversion rules.
Provides metadata describing the function's category, required and optional arguments, and documentation for help systems.
public abstract FunctionInfo FunctionInfo { get; }
The function info.
When true, FunctionBase automatically evaluates this function element-wise over any multi-element array argument and returns a spilled array result. Override to true in pure scalar functions (e.g. ABS, LEN, MOD) where applying the function independently to each element of an input array is the correct dynamic-array behavior. Leave false (the default) for reducers.
public virtual bool LiftsOverArrays { get; }
Methods
Evaluates the function using the provided evaluation context and returns the result as an expression. When LiftsOverArrays is true and at least one argument evaluates to a multi-element array, the function is evaluated element-wise over the broadcast dimensions via EvaluateLiftedElement(FunctionEvaluationContext<RadExpression>, RadExpression[], int, int) and a spilled ArrayExpression is returned.
public RadExpression Evaluate(FunctionEvaluationContext<RadExpression> context)
The context.
Returns:Function result as RadExpression.
Evaluates a single element during pointwise array lifting. Called once per cell in the broadcast result. The default implementation passes raw RadExpression arguments to EvaluateOverride(FunctionEvaluationContext<RadExpression>). FunctionWithArguments overrides this to apply argument conversion before calling EvaluateOverride(FunctionEvaluationContext<object>).
protected virtual ConstantExpression EvaluateLiftedElement(FunctionEvaluationContext<RadExpression> context, RadExpression[] resolvedArgs, int row, int col)
The original evaluation context (for worksheet, row/col, function expression).
resolvedArgsRadExpression[]All arguments resolved to constants (arrays preserved).
rowintThe current row in the broadcast result.
colintThe current column in the broadcast result.
Returns:The result for this cell, or an error expression.
Performs the function-specific evaluation logic; override in derived classes to implement custom calculation behavior.
protected virtual RadExpression EvaluateOverride(FunctionEvaluationContext<RadExpression> context)
The context.
Returns:Function result as RadExpression.
Validates that the argument count falls within the acceptable range for this function, accounting for required and optional parameters and repetition rules.
Determines whether the argument at argumentIndex can cause this function to
return a multi-element array (and therefore to spill). The default implementation combines
the argument metadata with the argument expression's array-return capability. Override when
spilling depends on the argument's runtime value.
public virtual bool IsSpillingArgument(int argumentIndex, RadExpression argument)