Formula Engine

formula_tokens_t ixion::parse_formula_string(iface::formula_model_access &cxt, const abs_address_t &pos, const formula_name_resolver &resolver, std::string_view formula)

Parse a raw formula expression string into formula tokens.

Return
formula tokens representing the parsed formula expression.
Parameters
  • cxt: model context.
  • pos: address of the cell that has the formula expression.
  • resolver: name resolver object used to resolve name tokens.
  • formula: raw formula expression string to parse.

std::string ixion::print_formula_tokens(const iface::formula_model_access &cxt, const abs_address_t &pos, const formula_name_resolver &resolver, const formula_tokens_t &tokens)

Convert formula tokens into a human-readable string representation.

Return
string representation of the formula tokens.
Parameters
  • cxt: model context.
  • pos: address of the cell that has the formula tokens.
  • resolver: name resolver object used to print name tokens.
  • tokens: formula tokens.

void ixion::register_formula_cell(iface::formula_model_access &cxt, const abs_address_t &pos, const formula_cell *cell = nullptr)

Regisiter a formula cell with cell dependency tracker.

Parameters
  • cxt: model context.
  • pos: address of the cell being registered. In case of grouped cells, the position must be that of teh top-left cell of that group.
  • cell: (optional) pointer to the formula cell object to register. You can skip this parameter, in which case the formula cell object will be fetched from the address of the cell. But passing a pointer will save the overhead of fetching.

void ixion::unregister_formula_cell(iface::formula_model_access &cxt, const abs_address_t &pos)

Unregister a formula cell with cell dependency tracker if a formula cell exists at specified cell address. If there is no existing cell at the specified address, or the cell is not a formula cell, this function is a no-op.

Parameters
  • cxt: model context.
  • pos: address of the cell being unregistered.

abs_address_set_t ixion::query_dirty_cells(iface::formula_model_access &cxt, const abs_address_set_t &modified_cells)

Get the positions of those formula cells that directly or indirectly depend on the specified source cells.

Return
collection of the positions of formula cells that directly or indirectly depend on at least one of the specified source cells.
Parameters
  • cxt: model context.
  • modified_cells: collection of the postiions of cells that have been modified.

std::vector<abs_range_t> ixion::query_and_sort_dirty_cells(iface::formula_model_access &cxt, const abs_range_set_t &modified_cells, const abs_range_set_t *dirty_formula_cells = nullptr)

Get a sequence of the positions of all formula cells that track at least one of the specified modified cells either directly or indirectly. Such formula cells are referred to as “dirty” formula cells. The sequence returned from this function is already sorted in topological order based on the dependency relationships between the affected formula cells. Note that if the model contains volatile formula cells, they will be included in the returned sequence each and every time.

Use query_dirty_cells() instead if you don’t need the results to be sorted in order of dependency, to avoid the extra overhead incurred by the sorting.

Return
an sequence containing the positions of the formula cells that track at least one of the modified cells, as well as those formula cells that are already known to be dirty.
Parameters
  • cxt: model context.
  • modified_cells: a collection of non-formula cells whose values have been updated. You can specify one or more ranges of cells rather than individual cell positions.
  • dirty_formula_cells: (optional) a collection of formula cells that are already known to be dirty. These formula cells will be added to the list of the affected formula cells returned from this function. Note that even though this parameter is a set of cell ranges, regular formula cell positions must be given as single cell addresses. Only the positions of grouped formula cells must be given as ranges.

void ixion::calculate_sorted_cells(iface::formula_model_access &cxt, const std::vector<abs_range_t> &formula_cells, size_t thread_count)

Calculate all specified formula cells in the order they occur in the sequence.

Parameters
  • cxt: model context.
  • formula_cells: formula cells to be calculated. The cells will be calculated in the order they appear in the sequence. In a typical use case, this will be the returned value from query_and_sort_dirty_cells.
  • thread_count: number of calculation threads to use. Note that passing 0 will make the process use the main thread only, while passing any number greater than 0 will make the process spawn specified number of calculation threads plus one additional thread to manage the calculation threads.

Formula Functions

enum ixion::formula_function_t

Enum that represents built-in formula functions.

Values:

func_unknown = 0
func_abs
func_acos
func_acosh
func_acot
func_acoth
func_address
func_aggregate
func_and
func_arabic
func_areas
func_asc
func_asin
func_asinh
func_atan
func_atan2
func_atanh
func_avedev
func_average
func_averagea
func_averageif
func_averageifs
func_b
func_bahttext
func_base
func_betadist
func_betainv
func_binomdist
func_bitand
func_bitlshift
func_bitor
func_bitrshift
func_bitxor
func_ceiling
func_cell
func_char
func_chidist
func_chiinv
func_chisqdist
func_chisqinv
func_chitest
func_choose
func_clean
func_code
func_color
func_column
func_columns
func_combin
func_combina
func_concat
func_concatenate
func_confidence
func_correl
func_cos
func_cosh
func_cot
func_coth
func_count
func_counta
func_countblank
func_countif
func_countifs
func_covar
func_critbinom
func_csc
func_csch
func_cumipmt
func_cumprinc
func_current
func_date
func_datedif
func_datevalue
func_daverage
func_day
func_days
func_days360
func_db
func_dcount
func_dcounta
func_ddb
func_dde
func_decimal
func_degrees
func_devsq
func_dget
func_dmax
func_dmin
func_dollar
func_dproduct
func_dstdev
func_dstdevp
func_dsum
func_dvar
func_dvarp
func_eastersunday
func_effect
func_encodeurl
func_errortype
func_euroconvert
func_even
func_exact
func_exp
func_expondist
func_fact
func_false
func_fdist
func_filterxml
func_find
func_findb
func_finv
func_fisher
func_fisherinv
func_fixed
func_floor
func_forecast
func_formula
func_fourier
func_frequency
func_ftest
func_fv
func_gamma
func_gammadist
func_gammainv
func_gammaln
func_gauss
func_gcd
func_geomean
func_getpivotdata
func_goalseek
func_growth
func_harmean
func_hlookup
func_hour
func_hyperlink
func_hypgeomdist
func_if
func_iferror
func_ifna
func_ifs
func_index
func_indirect
func_info
func_int
func_intercept
func_ipmt
func_irr
func_isblank
func_iserr
func_iserror
func_iseven
func_isformula
func_islogical
func_isna
func_isnontext
func_isnumber
func_isodd
func_isoweeknum
func_ispmt
func_isref
func_istext
func_jis
func_kurt
func_large
func_lcm
func_left
func_leftb
func_len
func_lenb
func_linest
func_ln
func_log
func_log10
func_logest
func_loginv
func_lognormdist
func_lookup
func_lower
func_match
func_max
func_maxa
func_maxifs
func_mdeterm
func_median
func_mid
func_midb
func_min
func_mina
func_minifs
func_minute
func_minverse
func_mirr
func_mmult
func_mod
func_mode
func_month
func_multirange
func_munit
func_mvalue
func_n
func_na
func_neg
func_negbinomdist
func_networkdays
func_nominal
func_normdist
func_norminv
func_normsdist
func_normsinv
func_not
func_now
func_nper
func_npv
func_numbervalue
func_odd
func_offset
func_or
func_pduration
func_pearson
func_percentile
func_percentrank
func_permut
func_permutationa
func_phi
func_pi
func_pmt
func_poisson
func_power
func_ppmt
func_prob
func_product
func_proper
func_pv
func_quartile
func_radians
func_rand
func_rank
func_rate
func_rawsubtract
func_regex
func_replace
func_replaceb
func_rept
func_right
func_rightb
func_roman
func_round
func_rounddown
func_roundsig
func_roundup
func_row
func_rows
func_rri
func_rsq
func_search
func_searchb
func_sec
func_sech
func_second
func_sheet
func_sheets
func_sign
func_sin
func_sinh
func_skew
func_skewp
func_sln
func_slope
func_small
func_sqrt
func_standardize
func_stdev
func_stdeva
func_stdevp
func_stdevpa
func_steyx
func_style
func_substitute
func_subtotal
func_sum
func_sumif
func_sumifs
func_sumproduct
func_sumsq
func_sumx2my2
func_sumx2py2
func_sumxmy2
func_switch
func_syd
func_t
func_tan
func_tanh
func_tdist
func_text
func_textjoin
func_time
func_timevalue
func_tinv
func_today
func_transpose
func_trend
func_trim
func_trimmean
func_true
func_trunc
func_ttest
func_type
func_unichar
func_unicode
func_upper
func_value
func_var
func_vara
func_varp
func_varpa
func_vdb
func_vlookup
func_wait
func_webservice
func_weekday
func_weeknum
func_weibull
func_xor
func_year
func_ztest
std::string_view ixion::get_formula_function_name(formula_function_t func)

Get a string representation of a formula function opcode.

Return
string representation of the opcode.
Parameters
  • func: formula function opcode.

formula_function_t ixion::get_formula_function_opcode(std::string_view s)

Get a formula function opcode from a formula function name.

Return
formula function opcode representing the specified name.
Parameters
  • s: formula function name.