public virtual IExpr ConstantOptimization() { _ArgExpr = _ArgExpr.ConstantOptimization(); if (_ArgExpr.IsConstant()) { string o = _ArgExpr.EvaluateString(null, null); if (o == null) { throw new Exception("User collection argument is null"); } string lo = o.ToLower(); if (lo == "userid") { return(new FunctionUserID()); } if (lo == "language") { return(new FunctionUserLanguage()); } throw new Exception(string.Format("User collection argument {0} is invalid.", o)); } return(this); }
public virtual IExpr ConstantOptimization() { _ArgExpr = _ArgExpr.ConstantOptimization(); if (_ArgExpr.IsConstant()) { string o = _ArgExpr.EvaluateString(null, null); if (o == null) throw new Exception("Globals collection argument is null"); switch (o.ToLower()) { case "pagenumber": return new FunctionPageNumber(); case "totalpages": return new FunctionTotalPages(); case "executiontime": return new FunctionExecutionTime(); case "reportfolder": return new FunctionReportFolder(); case "reportname": return new FunctionReportName(); default: throw new Exception(string.Format("Globals collection argument '{0}' is unknown.", o)); } } return this; }
public string EvaluateString(Report rpt, Row row) { object o = _Formatee.Evaluate(rpt, row); if (o == null) { return(null); } string format = _Format.EvaluateString(rpt, row); if (format == null) { return(o.ToString()); // just return string version of object } string result = null; try { result = String.Format("{0:" + format + "}", o); } catch // invalid format string specified { // treat as a weak error result = o.ToString(); } return(result); }
// public virtual object Evaluate(Report rpt, Row row) { if (rpt == null) { return(null); } string u = _ArgExpr.EvaluateString(rpt, row); if (u == null) { return(null); } switch (u.ToLower()) { case "userid": return(rpt.UserID); case "language": return(rpt.ClientLanguage == null? CultureInfo.CurrentCulture.ThreeLetterISOLanguageName: rpt.ClientLanguage); default: return(null); } }
public virtual IExpr ConstantOptimization() { _ArgExpr = _ArgExpr.ConstantOptimization(); if (_ArgExpr.IsConstant()) { string o = _ArgExpr.EvaluateString(null, null); if (o == null) { throw new Exception(Strings.FunctionUserCollection_Error_UserCollectionNull); } string lo = o.ToLower(); if (lo == "userid") { return(new FunctionUserID()); } if (lo == "language") { return(new FunctionUserLanguage()); } throw new Exception(string.Format(Strings.FunctionUserCollection_Error_UserCollectionInvalid, o)); } return(this); }
public string EvaluateString(Report rpt, Row row) { object o = _Formatee.Evaluate(rpt, row); if (o == null) { return(null); } string format = _Format.EvaluateString(rpt, row); if (format == null) { return(o.ToString()); // just return string version of object } string result = null; try { result = String.Format("{0:" + format + "}", o); } catch (Exception ex) // invalid format string specified { // treat as a weak error rpt.rl.LogError(2, String.Format("Format string:{1} Value Type:{2} Exception:{0}", ex.Message, format, o.GetType().Name)); result = o.ToString(); } return(result); }
// public virtual object Evaluate(Report rpt, Row row) { if (rpt == null) { return(null); } string g = _ArgExpr.EvaluateString(rpt, row); if (g == null) { return(null); } switch (g.ToLower()) { case "pagenumber": return(rpt.PageNumber); case "totalpages": return(rpt.TotalPages); case "executiontime": return(rpt.ExecutionTime); case "reportfolder": return(rpt.Folder); case "reportname": return(rpt.Name); default: return(null); } }
public virtual IExpr ConstantOptimization() { _ArgExpr = _ArgExpr.ConstantOptimization(); if (_ArgExpr.IsConstant()) { string o = _ArgExpr.EvaluateString(null, null); if (o == null) { throw new Exception("Globals collection argument is null"); } switch (o.ToLower()) { case "pagenumber": return(new FunctionPageNumber()); case "totalpages": return(new FunctionTotalPages()); case "executiontime": return(new FunctionExecutionTime()); case "reportfolder": return(new FunctionReportFolder()); case "reportname": return(new FunctionReportName()); default: throw new Exception(string.Format("Globals collection argument '{0}' is unknown.", o)); } } return(this); }
private void ResolveFields(string aggr, List <FunctionField> fargs, List <IExpr> args) { if (fargs == null || fargs.Count == 0) { return; } // get the scope argument offset int argOffset = aggr.ToLower() == "countrows"? 1: 2; DataSetDefn ds; if (args.Count == argOffset) { string dsname = null; IExpr e = args[argOffset - 1]; if (e is ConstantString) { dsname = e.EvaluateString(null, null); } if (dsname == null) { throw new ParserException(string.Format("{0} function's scope must be a constant.", aggr)); } ds = this.idLookup.ScopeDataSet(dsname); if (ds == null) { throw new ParserException(string.Format("Scope '{0}' does not reference a known DataSet.", dsname)); } } else { ds = this.idLookup.ScopeDataSet(null); if (ds == null) { throw new ParserException(string.Format("No scope provided for aggregate function '{0}' but more than one DataSet defined.", aggr)); } } foreach (FunctionField f in fargs) { if (f.Fld != null) { continue; } Field dsf = ds.Fields[f.Name]; if (dsf == null) { throw new ParserException(string.Format("Field '{0}' is not in DataSet {1}.", f.Name, ds.Name.Nm)); } f.Fld = dsf; } return; }
public string EvaluateString(Report rpt, Row row) { try { return(_Expr.EvaluateString(rpt, row)); } catch (Exception e) { string err = String.Format("Exception evaluating {0}. {1}", _Source, e.Message); ReportError(rpt, 4, err); return(null); } }
public virtual IExpr ConstantOptimization() { _ArgExpr = _ArgExpr.ConstantOptimization(); if (_ArgExpr.IsConstant()) { string o = _ArgExpr.EvaluateString(null, null); if (o == null) throw new Exception(Strings.FunctionParameterCollection_Error_ParameterCollectionNull); ReportParameter rp = _Parameters[o] as ReportParameter; if (rp == null) throw new Exception(string.Format(Strings.FunctionParameterCollection_Error_ParameterCollectionInvalid, o)); return new FunctionReportParameter(rp); } return this; }
public virtual IExpr ConstantOptimization() { _ArgExpr = _ArgExpr.ConstantOptimization(); if (_ArgExpr.IsConstant()) { string o = _ArgExpr.EvaluateString(null, null); if (o == null) throw new Exception("Field collection argument is null"); Field f = _Fields[o] as Field; if (f == null) throw new Exception(string.Format("Field collection argument {0} is invalid", o)); return new FunctionField(f); } return this; }
// public virtual object Evaluate(Report rpt, Row row) { string o = _ArgExpr.EvaluateString(rpt, row); if (o == null) { return(null); } ReportParameter rp = _Parameters[o] as ReportParameter; if (rp == null) { return(null); } return(rp.GetRuntimeValue(rpt)); }
public virtual IExpr ConstantOptimization() { _ArgExpr = _ArgExpr.ConstantOptimization(); if (_ArgExpr.IsConstant()) { string o = _ArgExpr.EvaluateString(null, null); if (o == null) throw new Exception("ReportItem collection argument is null"); Textbox ri = _ReportItems[o] as Textbox; if (ri == null) throw new Exception(string.Format("ReportItem collection argument {0} is invalid", o)); return new FunctionTextbox(ri, null); // no access to unique name } return this; }
public virtual IExpr ConstantOptimization() { _ArgExpr = _ArgExpr.ConstantOptimization(); if (_ArgExpr.IsConstant()) { string o = _ArgExpr.EvaluateString(null, null); if (o == null) throw new Exception(Strings.FunctionFieldCollection_Error_FieldCollectionNull); Field f = _Fields[o] as Field; if (f == null) throw new Exception(string.Format(Strings.FunctionFieldCollection_Error_FieldCollectionInvalid, o)); return new FunctionField(f); } return this; }
public virtual IExpr ConstantOptimization() { _ArgExpr = _ArgExpr.ConstantOptimization(); if (_ArgExpr.IsConstant()) { string o = _ArgExpr.EvaluateString(null, null); if (o == null) throw new Exception("Parameter collection argument is null"); ReportParameter rp = _Parameters[o] as ReportParameter; if (rp == null) throw new Exception(string.Format("Parameter collection argument {0} is invalid", o)); return new FunctionReportParameter(rp); } return this; }
public virtual IExpr ConstantOptimization() { _ArgExpr = _ArgExpr.ConstantOptimization(); if (_ArgExpr.IsConstant()) { string o = _ArgExpr.EvaluateString(null, null); if (o == null) throw new Exception(Strings.FunctionReportItemCollection_Error_ReportItemCollectionNull); Textbox ri = _ReportItems[o] as Textbox; if (ri == null) throw new Exception(string.Format(Strings.FunctionReportItemCollection_Error_ReportItemCollectionInvalid, o)); return new FunctionTextbox(ri, null); // no access to unique name } return this; }
public virtual IExpr ConstantOptimization() { _ArgExpr = _ArgExpr.ConstantOptimization(); if (_ArgExpr.IsConstant()) { string o = _ArgExpr.EvaluateString(null, null); if (o == null) throw new Exception(Strings.FunctionUserCollection_Error_UserCollectionNull); string lo = o.ToLower(); if (lo == "userid") return new FunctionUserID(); if (lo == "language") return new FunctionUserLanguage(); throw new Exception(string.Format(Strings.FunctionUserCollection_Error_UserCollectionInvalid, o)); } return this; }
public virtual IExpr ConstantOptimization() { _ArgExpr = _ArgExpr.ConstantOptimization(); if (_ArgExpr.IsConstant()) { string o = _ArgExpr.EvaluateString(null, null); if (o == null) throw new Exception("User collection argument is null"); string lo = o.ToLower(); if (lo == "userid") return new FunctionUserID(); if (lo == "language") return new FunctionUserLanguage(); throw new Exception(string.Format("User collection argument {0} is invalid.", o)); } return this; }
// public virtual object Evaluate(Report rpt, Row row) { if (row == null) { return(null); } Field f; string field = _ArgExpr.EvaluateString(rpt, row); if (field == null) { return(null); } f = _Fields[field] as Field; if (f == null) { return(null); } object o; if (f.Value != null) { o = f.Value.Evaluate(rpt, row); } else { o = row.Data[f.ColumnNumber]; } if (o == DBNull.Value) { return(null); } if (f.RunType == TypeCode.String && o is char) // work around; mono odbc driver confuses string and char { o = Convert.ChangeType(o, TypeCode.String); } return(o); }
public virtual IExpr ConstantOptimization() { _ArgExpr = _ArgExpr.ConstantOptimization(); if (_ArgExpr.IsConstant()) { string o = _ArgExpr.EvaluateString(null, null); if (o == null) { throw new Exception(Strings.FunctionParameterCollection_Error_ParameterCollectionNull); } ReportParameter rp = _Parameters[o] as ReportParameter; if (rp == null) { throw new Exception(string.Format(Strings.FunctionParameterCollection_Error_ParameterCollectionInvalid, o)); } return(new FunctionReportParameter(rp)); } return(this); }
public virtual IExpr ConstantOptimization() { _ArgExpr = _ArgExpr.ConstantOptimization(); if (_ArgExpr.IsConstant()) { string o = _ArgExpr.EvaluateString(null, null); if (o == null) { throw new Exception("ReportItem collection argument is null"); } Textbox ri = _ReportItems[o] as Textbox; if (ri == null) { throw new Exception(string.Format("ReportItem collection argument {0} is invalid", o)); } return(new FunctionTextbox(ri, null)); // no access to unique name } return(this); }
// public virtual object Evaluate(Report rpt, Row row) { if (row == null) { return(null); } Textbox tb; string t = _ArgExpr.EvaluateString(rpt, row); if (t == null) { return(null); } tb = _ReportItems[t] as Textbox; if (tb == null) { return(null); } return(tb.Evaluate(rpt, row)); }
public virtual IExpr ConstantOptimization() { _ArgExpr = _ArgExpr.ConstantOptimization(); if (_ArgExpr.IsConstant()) { string o = _ArgExpr.EvaluateString(null, null); if (o == null) { throw new Exception(Strings.FunctionReportItemCollection_Error_ReportItemCollectionNull); } Textbox ri = _ReportItems[o] as Textbox; if (ri == null) { throw new Exception(string.Format(Strings.FunctionReportItemCollection_Error_ReportItemCollectionInvalid, o)); } return(new FunctionTextbox(ri, null)); // no access to unique name } return(this); }
public virtual IExpr ConstantOptimization() { _ArgExpr = _ArgExpr.ConstantOptimization(); if (_ArgExpr.IsConstant()) { string o = _ArgExpr.EvaluateString(null, null); if (o == null) { throw new Exception("Field collection argument is null"); } Field f = _Fields[o] as Field; if (f == null) { throw new Exception(string.Format("Field collection argument {0} is invalid", o)); } return(new FunctionField(f)); } return(this); }
public virtual IExpr ConstantOptimization() { _ArgExpr = _ArgExpr.ConstantOptimization(); if (_ArgExpr.IsConstant()) { string o = _ArgExpr.EvaluateString(null, null); if (o == null) { throw new Exception("Parameter collection argument is null"); } ReportParameter rp = _Parameters[o] as ReportParameter; if (rp == null) { throw new Exception(string.Format("Parameter collection argument {0} is invalid", o)); } return(new FunctionReportParameter(rp)); } return(this); }
public virtual IExpr ConstantOptimization() { _ArgExpr = _ArgExpr.ConstantOptimization(); if (_ArgExpr.IsConstant()) { string o = _ArgExpr.EvaluateString(null, null); if (o == null) { throw new Exception(Strings.FunctionFieldCollection_Error_FieldCollectionNull); } Field f = _Fields[o] as Field; if (f == null) { throw new Exception(string.Format(Strings.FunctionFieldCollection_Error_FieldCollectionInvalid, o)); } return(new FunctionField(f)); } return(this); }