/// <summary> /// /// </summary> /// <param name="fn"></param> /// <returns></returns> private Fun buildfunction(Fun fn) // count,ucount,min,max,medium,mode,range,filter,avg, { var gVal = getValue(FunDefination.fun, _current.Value); if (gVal != "") { var items = split(FunDefination.splitbyComma, gVal); if (items.Length == 3) { fn.Datasource = items[0]; var conditionstr = split(FunDefination.splitbyComma, items[1].Replace("[", "").Replace("]", "")).ToList(); foreach (string s in conditionstr) { var f = split(":", s); if (f.Length == 2) { fn.AddFields(f[0], FieldType.String, f[1]); } else { AddError(Source.Severity.Error, "Invalid function", _current.Span); } } fn.ActionField = items[2]; //fn.AddFields() } else if (items.Length == 2) { fn.Datasource = items[0]; var conditionstr = split(FunDefination.splitbyComma, items[1].Replace("[", "").Replace("]", "")).ToList(); foreach (string s in conditionstr) { var f = split(":", s); if (f.Length == 2) { fn.AddFields(f[0], FieldType.String, f[1]); } else { AddError(Source.Severity.Error, "Invalid function", _current.Span); } } } } else { AddError(Source.Severity.Error, "Invalid function", _current.Span); } return(fn); }
private Fun buildGetValuefunction(Fun fn) { // count,ucount,min,max,medium,mode,range,filter,avg, var gVal = getValue(FunDefination.fun, _current.Value); if (gVal != "") { var items = split(FunDefination.splitbyComma, gVal); if (items.Length == 2) { fn.Datasource = items[0]; fn.AddFields(items[1], FieldType.String, ""); //fn.AddFields() } else { AddError(Source.Severity.Error, "Invalid function:" + gVal, _current.Span); } } else { AddError(Source.Severity.Error, "Invalid function", _current.Span); } return(fn); }