Base class for formula functions that provides common functionality for evaluation.
Object
Namespace: Radzen.Documents.Spreadsheet
Assembly: Radzen.Blazor.dll
public abstract class FormulaFunctionBase class for formula functions that provides common functionality for evaluation.
protected FormulaFunction()Gets a value indicating whether this function can handle error arguments. Functions that return true will receive error values as arguments instead of having evaluation short-circuited.
public bool CanHandleErrors { get; }
| Type | Description |
|---|---|
| bool | Gets a value indicating whether this function can handle error arguments. Functions that return true will receive error values as arguments instead of having evaluation short-circuited. |
Gets a value indicating whether literal boolean arguments in sequences should be coerced to numbers (TRUE→1, FALSE→0) before evaluation. Excel coerces direct boolean constants (e.g. SUM(TRUE,1)→2) but skips booleans from cell references (e.g. SUM(A1)→0 when A1=TRUE).
public bool CoerceLiteralBooleans { get; }
| Type | Description |
|---|---|
| bool | Gets a value indicating whether literal boolean arguments in sequences should be coerced to numbers (TRUE→1, FALSE→0) before evaluation. Excel coerces direct boolean constants (e.g. SUM(TRUE,1)→2) but skips booleans from cell references (e.g. SUM(A1)→0 when A1=TRUE). |
Gets the name of the function.
public string Name { get; }
| Type | Description |
|---|---|
| string | Gets the name of the function. |
Gets the parameter definitions for this function.
public Documents.Spreadsheet.FunctionParameter[] Parameters { get; }
| Type | Description |
|---|---|
| Documents.Spreadsheet.FunctionParameter[] | Gets the parameter definitions for this function. |
Evaluates the function with the given arguments.
public abstract Documents.Spreadsheet.CellData Evaluate(Documents.Spreadsheet.FunctionArguments arguments)
| Type | Name | Description |
|---|---|---|
| Documents.Spreadsheet.FunctionArguments | arguments | The function arguments organized by parameter name. |
| Type | Description |
|---|---|
| Documents.Spreadsheet.CellData | The result value wrapped in CellData. |
Tries to get an integer parameter from the function arguments.
protected static bool TryGetInteger(Documents.Spreadsheet.FunctionArguments arguments, string parameterName, bool isRequired, int? defaultValue, Int32& value, Documents.Spreadsheet.CellData& error)
| Type | Name | Description |
|---|---|---|
| Documents.Spreadsheet.FunctionArguments | arguments | The function arguments organized by parameter name. |
| string | parameterName | The name of the parameter to get. |
| bool | isRequired | Whether the parameter is required. |
| int? | defaultValue | The default value if the parameter is not provided. |
| Int32& | value | The integer value of the parameter. |
| Documents.Spreadsheet.CellData& | error | The error value if the parameter is not an integer. |
| Type | Description |
|---|---|
| bool |
Tries to get a numeric parameter from the function arguments, coercing booleans and numeric text.
protected static bool TryGetNumber(Documents.Spreadsheet.FunctionArguments arguments, string parameterName, bool isRequired, double? defaultValue, Double& value, Documents.Spreadsheet.CellData& error)
| Type | Name | Description |
|---|---|---|
| Documents.Spreadsheet.FunctionArguments | arguments | |
| string | parameterName | |
| bool | isRequired | |
| double? | defaultValue | |
| Double& | value | |
| Documents.Spreadsheet.CellData& | error |
| Type | Description |
|---|---|
| bool |
Tries to get a string parameter from the function arguments.
protected static bool TryGetString(Documents.Spreadsheet.FunctionArguments arguments, string parameterName, String& text, Documents.Spreadsheet.CellData& error)
| Type | Name | Description |
|---|---|---|
| Documents.Spreadsheet.FunctionArguments | arguments | The function arguments organized by parameter name. |
| string | parameterName | The name of the parameter to get. |
| String& | text | The string value of the parameter. |
| Documents.Spreadsheet.CellData& | error | The error value if the parameter is not a string. |
| Type | Description |
|---|---|
| bool | True if the parameter is a string, false otherwise. |