public override WhereClause AddGlobalWhereClause() { CompoundFilter filter = new CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, null); WhereClause wc = new WhereClause(); String formula; if (BaseFormulaEvaluator.ShouldApplyGlobalWhereClause("1")) { formula = EvaluateFormula("1"); filter.AddFilter(new BaseClasses.Data.ColumnValueFilter(PhotoClubContactLinksTable.RecordDeleted, formula, BaseClasses.Data.BaseFilter.ComparisonOperator.Not_Equals, false)); wc.AddFilter(filter, CompoundFilter.CompoundingOperators.And_Operator); } return(wc); }
public override WhereClause AddGlobalWhereClause() { CompoundFilter filter = new CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, null); WhereClause wc = new WhereClause(); String formula; if (BaseFormulaEvaluator.ShouldApplyGlobalWhereClause("Session(\"ActiveEventId\")")) { formula = EvaluateFormula("Session(\"ActiveEventId\")"); filter.AddFilter(new BaseClasses.Data.ColumnValueFilter(FieldTripsTable.EventId, formula, BaseClasses.Data.BaseFilter.ComparisonOperator.EqualsTo, false)); wc.AddFilter(filter, CompoundFilter.CompoundingOperators.And_Operator); } return(wc); }
/// <summary> /// Evaluates the formula /// </summary> public static string EvaluateFormula(string formula, BaseClasses.Data.BaseRecord dataSourceForEvaluate, string format, string name) { BaseFormulaEvaluator e = new BaseFormulaEvaluator(); if(dataSourceForEvaluate != null) e.Evaluator.Variables.Add(name, dataSourceForEvaluate); e.DataSource = dataSourceForEvaluate; object resultObj = e.Evaluate(formula); if (resultObj == null) return ""; if (!string.IsNullOrEmpty(format)) return BaseFormulaUtils.Format(resultObj, format); else return resultObj.ToString(); }
public override WhereClause AddGlobalWhereClause() { CompoundFilter filter = new CompoundFilter(CompoundFilter.CompoundingOperators.And_Operator, null); WhereClause wc = new WhereClause(); String formula; if (BaseFormulaEvaluator.ShouldApplyGlobalWhereClause("\"registration\"")) { formula = EvaluateFormula("\"registration\""); filter.AddFilter(new BaseClasses.Data.ColumnValueFilter(UsersTable.UserName0, formula, BaseClasses.Data.BaseFilter.ComparisonOperator.Not_Equals, false)); wc.AddFilter(filter, CompoundFilter.CompoundingOperators.And_Operator); } return(wc); }
/** * Loops over all cells in all sheets of the supplied * workbook. * For cells that contain formulas, their formulas are * evaluated, and the results are saved. These cells * remain as formula cells. * For cells that do not contain formulas, no changes * are made. * This is a helpful wrapper around looping over all * cells, and calling evaluateFormulaCell on each one. */ public new static void EvaluateAllFormulaCells(IWorkbook wb) { BaseFormulaEvaluator.EvaluateAllFormulaCells(wb); }
/** * Coordinates several formula evaluators together so that formulas that involve external * references can be evaluated. * @param workbookNames the simple file names used to identify the workbooks in formulas * with external links (for example "MyData.xls" as used in a formula "[MyData.xls]Sheet1!A1") * @param evaluators all evaluators for the full set of workbooks required by the formulas. */ public static void SetupEnvironment(String[] workbookNames, HSSFFormulaEvaluator[] evaluators) { BaseFormulaEvaluator.SetupEnvironment(workbookNames, evaluators); }
/** * Loops over all cells in all sheets of the supplied * workbook. * For cells that contain formulas, their formulas are * Evaluated, and the results are saved. These cells * remain as formula cells. * For cells that do not contain formulas, no Changes * are made. * This is a helpful wrapper around looping over all * cells, and calling EvaluateFormulaCell on each one. */ public static void EvaluateAllFormulaCells(XSSFWorkbook wb) { BaseFormulaEvaluator.EvaluateAllFormulaCells(wb); }