Cannot seem to apply my own expression around the field. Database trace still says
"Trunc(Avg(field),28)" and I still get the arithmetic overflow error.
My goal in this test is to contain the field aggregate/trunc with a Floor function
e.g. "Floor(Trunc(Avg(field),28)"
Below is the calling code that I am using. The IExpression implementation is the same as yours. Any idea why my Floor isn't getting appended to the sql statement?
//create a filter predicate added to f (the predicate expression)
f.Add(PredicateFactory.CompareValue(Hello_C95FieldIndex.Pmp,
ComparisonOperator.GreaterEqual, val));
IPredicateExpressionElement p = (IPredicateExpressionElement)f[0];
FieldCompareValuePredicate fp = (FieldCompareValuePredicate)p.Contents;
IExpression trun = new F18DAL.FunctionExpression(EntityFieldFactory.Create(Hello_C95FieldIndex.Pmp),
"Floor");
fp.FieldCore.ExpressionToApply = trun;
//using the parentheses and the logic operators, organize the p.ex's
ResultsetFields fields = new ResultsetFields(3);
fields.DefineField(Hello_C95FieldIndex.Pmp, 0, "PmpAvg", "Hello_C95", AggregateFunction.Avg);
fields.DefineField(FlightsynFieldIndex.Name, 1, "Name");
fields.DefineField(FlightsynFieldIndex.Segmentstart, 2, "Segmentstart");
IRelationCollection relations = new RelationCollection();
relations.Add(FlightsynEntity.Relations.RecsynEntityUsingFlightid);
relations.Add(RecsynEntity.Relations.Hello_C95EntityUsingRecordid);
IGroupByCollection groupByClause = new GroupByCollection();
groupByClause.Add(fields[1]);
groupByClause.Add(fields[2]);
DataTable dynamicList = new DataTable();
TypedListDAO dao = new TypedListDAO();
dao.GetMultiAsDataTable(fields, dynamicList, 0, null, f, relations, true, groupByClause, null, 0, 0);
---Thanks