public bool IsIndicatorFormulaValidForFieldset(int fieldsetId, string formula)
        {
            var fields = fieldRepo.GetAssigned(fieldsetId);
            var calc   = new CalcContext <decimal>();

            foreach (var field in fields)
            {
                calc.Constants.Add("c" + field.Id, 1);
            }

            try
            {
                calc.Validate(formula);
                return(true);
            }
            catch (SyntaxException)
            {
                return(false);
            }
        }
Beispiel #2
0
 public IEnumerable <Field> GetAssignedFields(int fieldsetId)
 {
     return(fieldRepo.GetAssigned(fieldsetId));
 }