WYRDTEK Home Features Reference Downloads About


Reference/es_mba_addfilter

Syntax

int es_mba_addformula( struct es_mba *agg,
                       const char *formuladefn,
                       char *errbuf,
                       unsigned errbufsize );

Arguments

struct es_mba *agg Database aggregator.
const char *formuladefn Formula definition.
char *errbuf Error message buffer. Populated by es_mba_addfilter() on error.

Return Codes

ES_ERROR_NONE Success. No errors.
ES_ERROR_INVALIDFIELDTYPE formuladefn does not resolve to an integer type.
ES_ERROR_FAILTOPARSE Failed to parse formuladefn. errbuf is populated with an error message.

Description

Create an algebraic formula to be used to filter-out rows in the query plan.

Formula construction follows the same rules as es_mba_addformula() with the difference that the formula must yield an integer result. A formula result of zero indicates that a row of data should not be incorporated in the aggregate result.

For example, a formula to filter for all sales made in 2007 might look something like:

struct es_mba *agg;
char errbuf[1024];
es_mba_addfilter( agg, "getyear(SaleDate)==2007", errbuf, 1024 );

[Back To Reference] [Back To Reference/es_mba]