Hi Walaa,
I already did use the FieldCompareSetPredicate as follows (part of the code) :
relations.Add(EntityClasses.TransactionEntity.Relations.DepotEntityUsingDepotId)
relations.Add(EntityClasses.TransactionEntity.Relations.TransactionDetailEntityUsingTransactionUid)
fields.DefineField(TransactionFieldIndex.DepotId, 0, "DepotId")
fields.DefineField(TransactionDetailFieldIndex.Quantity, 1, "SumOfQuantity", "", AggregateFunction.Sum)
groupByClause.Add(fields(0))
existsFilter.Add(PredicateFactory.Between(TransactionFieldIndex.TransactionDate, dateFrom, dateTo))
existsFilter.Add(PredicateFactory.CompareValue(TransactionFieldIndex.DepotId, _
ComparisonOperator.Equal, New Expression(TransactionFields.DepotId)))
filter.Add(New FieldCompareSetPredicate(TransactionFields.DepotId, TransactionFields.DepotId, SetOperator.Exist, existsFilter, Nothing, "", 0, Nothing, True, Nothing))
havingFilter.Add(New FieldCompareValuePredicate(fields(1), operator, 0))
groupByClause.HavingClause = havingFilter
dao.GetMultiAsDataTable(fields, dt, 0, Nothing, filter, relations, False, groupByClause, Nothing, 0, 0)
When I run the code, an error occurs on the dao.GetMultiAsDataTable : Object must implement IConvertible. When I comment out the last existsFilter (the one with the New Expression), then the query just runs fine and produces the SQL as shown in the first post, but the last filter just has to be included to get the right results.
Any ideas ?
Greetings,
Danny