Formula Engine
-
formula_tokens_t ixion::parse_formula_string(model_context &cxt, const abs_address_t &pos, const formula_name_resolver &resolver, std::string_view formula)
Parse a raw formula expression string into formula tokens.
- 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.
- Returns:
formula tokens representing the parsed formula expression.
-
std::string ixion::print_formula_tokens(const model_context &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.
- 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.
- Returns:
string representation of the formula tokens.
-
void ixion::register_formula_cell(model_context &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(model_context &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(model_context &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.
- Parameters:
cxt – model context.
modified_cells – collection of the postiions of cells that have been modified.
- Returns:
collection of the positions of formula cells that directly or indirectly depend on at least one of the specified source cells.
-
std::vector<abs_range_t> ixion::query_and_sort_dirty_cells(model_context &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.
- 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.
- Returns:
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.
-
void ixion::calculate_sorted_cells(model_context &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 class ixion::formula_function_t : uint16_t
Enum that represents built-in formula functions.
Values:
-
enumerator func_unknown
-
enumerator func_abs
-
enumerator func_acos
-
enumerator func_acosh
-
enumerator func_acot
-
enumerator func_acoth
-
enumerator func_address
-
enumerator func_aggregate
-
enumerator func_and
-
enumerator func_arabic
-
enumerator func_areas
-
enumerator func_asc
-
enumerator func_asin
-
enumerator func_asinh
-
enumerator func_atan
-
enumerator func_atan2
-
enumerator func_atanh
-
enumerator func_avedev
-
enumerator func_average
-
enumerator func_averagea
-
enumerator func_averageif
-
enumerator func_averageifs
-
enumerator func_b
-
enumerator func_bahttext
-
enumerator func_base
-
enumerator func_betadist
-
enumerator func_betainv
-
enumerator func_binomdist
-
enumerator func_bitand
-
enumerator func_bitlshift
-
enumerator func_bitor
-
enumerator func_bitrshift
-
enumerator func_bitxor
-
enumerator func_ceiling
-
enumerator func_cell
-
enumerator func_char
-
enumerator func_chidist
-
enumerator func_chiinv
-
enumerator func_chisqdist
-
enumerator func_chisqinv
-
enumerator func_chitest
-
enumerator func_choose
-
enumerator func_clean
-
enumerator func_code
-
enumerator func_color
-
enumerator func_column
-
enumerator func_columns
-
enumerator func_combin
-
enumerator func_combina
-
enumerator func_concat
-
enumerator func_concatenate
-
enumerator func_confidence
-
enumerator func_correl
-
enumerator func_cos
-
enumerator func_cosh
-
enumerator func_cot
-
enumerator func_coth
-
enumerator func_count
-
enumerator func_counta
-
enumerator func_countblank
-
enumerator func_countif
-
enumerator func_countifs
-
enumerator func_covar
-
enumerator func_critbinom
-
enumerator func_csc
-
enumerator func_csch
-
enumerator func_cumipmt
-
enumerator func_cumprinc
-
enumerator func_current
-
enumerator func_date
-
enumerator func_datedif
-
enumerator func_datevalue
-
enumerator func_daverage
-
enumerator func_day
-
enumerator func_days
-
enumerator func_days360
-
enumerator func_db
-
enumerator func_dcount
-
enumerator func_dcounta
-
enumerator func_ddb
-
enumerator func_dde
-
enumerator func_decimal
-
enumerator func_degrees
-
enumerator func_devsq
-
enumerator func_dget
-
enumerator func_dmax
-
enumerator func_dmin
-
enumerator func_dollar
-
enumerator func_dproduct
-
enumerator func_dstdev
-
enumerator func_dstdevp
-
enumerator func_dsum
-
enumerator func_dvar
-
enumerator func_dvarp
-
enumerator func_eastersunday
-
enumerator func_effect
-
enumerator func_encodeurl
-
enumerator func_errortype
-
enumerator func_euroconvert
-
enumerator func_even
-
enumerator func_exact
-
enumerator func_exp
-
enumerator func_expondist
-
enumerator func_fact
-
enumerator func_false
-
enumerator func_fdist
-
enumerator func_filterxml
-
enumerator func_find
-
enumerator func_findb
-
enumerator func_finv
-
enumerator func_fisher
-
enumerator func_fisherinv
-
enumerator func_fixed
-
enumerator func_floor
-
enumerator func_forecast
-
enumerator func_formula
-
enumerator func_fourier
-
enumerator func_frequency
-
enumerator func_ftest
-
enumerator func_fv
-
enumerator func_gamma
-
enumerator func_gammadist
-
enumerator func_gammainv
-
enumerator func_gammaln
-
enumerator func_gauss
-
enumerator func_gcd
-
enumerator func_geomean
-
enumerator func_getpivotdata
-
enumerator func_goalseek
-
enumerator func_growth
-
enumerator func_harmean
-
enumerator func_hlookup
-
enumerator func_hour
-
enumerator func_hyperlink
-
enumerator func_hypgeomdist
-
enumerator func_if
-
enumerator func_iferror
-
enumerator func_ifna
-
enumerator func_ifs
-
enumerator func_index
-
enumerator func_indirect
-
enumerator func_info
-
enumerator func_int
-
enumerator func_intercept
-
enumerator func_ipmt
-
enumerator func_irr
-
enumerator func_isblank
-
enumerator func_iserr
-
enumerator func_iserror
-
enumerator func_iseven
-
enumerator func_isformula
-
enumerator func_islogical
-
enumerator func_isna
-
enumerator func_isnontext
-
enumerator func_isnumber
-
enumerator func_isodd
-
enumerator func_isoweeknum
-
enumerator func_ispmt
-
enumerator func_isref
-
enumerator func_istext
-
enumerator func_jis
-
enumerator func_kurt
-
enumerator func_large
-
enumerator func_lcm
-
enumerator func_left
-
enumerator func_leftb
-
enumerator func_len
-
enumerator func_lenb
-
enumerator func_linest
-
enumerator func_ln
-
enumerator func_log
-
enumerator func_log10
-
enumerator func_logest
-
enumerator func_loginv
-
enumerator func_lognormdist
-
enumerator func_lookup
-
enumerator func_lower
-
enumerator func_match
-
enumerator func_max
-
enumerator func_maxa
-
enumerator func_maxifs
-
enumerator func_mdeterm
-
enumerator func_median
-
enumerator func_mid
-
enumerator func_midb
-
enumerator func_min
-
enumerator func_mina
-
enumerator func_minifs
-
enumerator func_minute
-
enumerator func_minverse
-
enumerator func_mirr
-
enumerator func_mmult
-
enumerator func_mod
-
enumerator func_mode
-
enumerator func_month
-
enumerator func_multirange
-
enumerator func_munit
-
enumerator func_mvalue
-
enumerator func_n
-
enumerator func_na
-
enumerator func_neg
-
enumerator func_negbinomdist
-
enumerator func_networkdays
-
enumerator func_nominal
-
enumerator func_normdist
-
enumerator func_norminv
-
enumerator func_normsdist
-
enumerator func_normsinv
-
enumerator func_not
-
enumerator func_now
-
enumerator func_nper
-
enumerator func_npv
-
enumerator func_numbervalue
-
enumerator func_odd
-
enumerator func_offset
-
enumerator func_or
-
enumerator func_pduration
-
enumerator func_pearson
-
enumerator func_percentile
-
enumerator func_percentrank
-
enumerator func_permut
-
enumerator func_permutationa
-
enumerator func_phi
-
enumerator func_pi
-
enumerator func_pmt
-
enumerator func_poisson
-
enumerator func_power
-
enumerator func_ppmt
-
enumerator func_prob
-
enumerator func_product
-
enumerator func_proper
-
enumerator func_pv
-
enumerator func_quartile
-
enumerator func_radians
-
enumerator func_rand
-
enumerator func_rank
-
enumerator func_rate
-
enumerator func_rawsubtract
-
enumerator func_regex
-
enumerator func_replace
-
enumerator func_replaceb
-
enumerator func_rept
-
enumerator func_right
-
enumerator func_rightb
-
enumerator func_roman
-
enumerator func_round
-
enumerator func_rounddown
-
enumerator func_roundsig
-
enumerator func_roundup
-
enumerator func_row
-
enumerator func_rows
-
enumerator func_rri
-
enumerator func_rsq
-
enumerator func_search
-
enumerator func_searchb
-
enumerator func_sec
-
enumerator func_sech
-
enumerator func_second
-
enumerator func_sheet
-
enumerator func_sheets
-
enumerator func_sign
-
enumerator func_sin
-
enumerator func_sinh
-
enumerator func_skew
-
enumerator func_skewp
-
enumerator func_sln
-
enumerator func_slope
-
enumerator func_small
-
enumerator func_sqrt
-
enumerator func_standardize
-
enumerator func_stdev
-
enumerator func_stdeva
-
enumerator func_stdevp
-
enumerator func_stdevpa
-
enumerator func_steyx
-
enumerator func_style
-
enumerator func_substitute
-
enumerator func_subtotal
-
enumerator func_sum
-
enumerator func_sumif
-
enumerator func_sumifs
-
enumerator func_sumproduct
-
enumerator func_sumsq
-
enumerator func_sumx2my2
-
enumerator func_sumx2py2
-
enumerator func_sumxmy2
-
enumerator func_switch
-
enumerator func_syd
-
enumerator func_t
-
enumerator func_tan
-
enumerator func_tanh
-
enumerator func_tdist
-
enumerator func_text
-
enumerator func_textjoin
-
enumerator func_time
-
enumerator func_timevalue
-
enumerator func_tinv
-
enumerator func_today
-
enumerator func_transpose
-
enumerator func_trend
-
enumerator func_trim
-
enumerator func_trimmean
-
enumerator func_true
-
enumerator func_trunc
-
enumerator func_ttest
-
enumerator func_type
-
enumerator func_unichar
-
enumerator func_unicode
-
enumerator func_upper
-
enumerator func_value
-
enumerator func_var
-
enumerator func_vara
-
enumerator func_varp
-
enumerator func_varpa
-
enumerator func_vdb
-
enumerator func_vlookup
-
enumerator func_wait
-
enumerator func_webservice
-
enumerator func_weekday
-
enumerator func_weeknum
-
enumerator func_weibull
-
enumerator func_xor
-
enumerator func_year
-
enumerator func_ztest
-
enumerator func_unknown
-
std::string_view ixion::get_formula_function_name(formula_function_t func)
Get a string representation of a formula function opcode.
- Parameters:
func – formula function opcode.
- Returns:
string representation of the opcode.
-
formula_function_t ixion::get_formula_function_opcode(std::string_view s)
Get a formula function opcode from a formula function name.
- Parameters:
s – formula function name.
- Returns:
formula function opcode representing the specified name.