IFormulas

Defines the public contract for the Formulas class, exposing read-only access to parsing results, validity checks, and derived Excel expressions for both linelist and analysis contexts.

Depends on: BetterArray, Checking, IFormulaCondition

Elements

Varlists #

Retrieve the variables referenced by the setup formula

Signature:

Public Property Get Varlists(Optional ByVal formulaType As String = "analysis") As BetterArray

Parsed formula metadata and variable lists. Returns a clone of the variable names detected during tokenisation. The formulaType parameter controls whether the formula is evaluated in an analysis or simple context.

Parameters:

  • formulaType: Optional String. Context (analysis/simple).

Returns: BetterArray. Copy of variable names.


FormulaTableList #

Retrieve the tokenised representation of the formula

Signature:

Public Property Get FormulaTableList() As BetterArray

Returns a clone of the ordered token list produced during parsing.

Returns: BetterArray. Ordered tokens.


HasSetupVariables #

Determine whether the formula contains literal values

Signature:

Public Property Get HasSetupVariables() As Boolean

Returns True when numeric or text literals were encountered during tokenisation.

Returns: Boolean. True when literals are present.


IsGrouped #

Indicate whether the parsed formula targets grouped evaluation

Signature:

Public Property Get IsGrouped() As String

Returns "Yes" when the formula uses a grouped function (e.g. GROUP_SUM), "No" otherwise.

Returns: String. "Yes" for grouped formulas, "No" otherwise.


HasChecking #

Determine whether parsing recorded diagnostic messages

Signature:

Public Property Get HasChecking() As Boolean

Returns True when at least one checking entry was logged during evaluation.

Returns: Boolean. True when internal checkings exist.


CheckingValues #

Retrieve the internal checking log

Signature:

Public Property Get CheckingValues() As IChecking

Returns the IChecking store containing accumulated diagnostics logged during evaluation.

Returns: IChecking. Accumulated diagnostics.


Reason #

Provide the last computed validity explanation

Signature:

Public Property Get Reason(Optional ByVal formulaType As String = "analysis") As String

Returns a human-readable message describing the validity outcome for the requested context. Returns the default success message when the formula is valid.

Parameters:

  • formulaType: Optional String. Context (analysis/simple).

Returns: String. Message describing the validity outcome.


Operations

Valid #

Determine whether the formula is valid for the supplied context

Signature:

Public Property Get Valid(Optional ByVal formulaType As String = "analysis") As Boolean

Validation and Excel formula generation. Triggers a lazy evaluation for the requested context and returns the cached validity flag.

Parameters:

  • formulaType: Optional String. Context (analysis/simple).

Returns: Boolean. Validity flag.


ParsedLinelistFormula #

Build the Excel expression for a linelist worksheet

Signature:

Public Property Get ParsedLinelistFormula(Optional ByVal useTableName As Boolean = False, _
                                          Optional ByVal tablePrefix As String = vbNullString) As String

Replaces variable tokens with worksheet addresses or structured references depending on the useTableName flag.

Parameters:

  • useTableName: Optional Boolean. True to use structured references.
  • tablePrefix: Optional String. Prefix for structured references.

Returns: String. Excel formula text.


ParsedAnalysisFormula #

Build the Excel expression for an analysis worksheet

Signature:

Public Property Get ParsedAnalysisFormula(ByVal formCond As IFormulaCondition, _
                                          Optional ByVal tablePrefix As String = vbNullString, _
                                          Optional ByVal Connector As String = "*") As String

Replaces variable tokens with conditional aggregation fragments supplied by the IFormulaCondition provider.

Parameters:

  • formCond: IFormulaCondition. Provides aggregator behaviour.
  • tablePrefix: Optional String. Prefix for structured references.
  • Connector: Optional String. Connector between conditions.

Returns: String. Excel formula text.