(LifeNstuffArticleImageFields.LifeNstuffArticleImageId == articleID)
is a filter not an expression. (Predicate & PredicateExpression are filters)
Filters are equalities performed in the query to limit the returned result set.
On the other hand something like this: (OrderFields.ShippedDate - OrderFields.OrderDate)
is an Expression.
Expressions are equations that are used to manupulate the returned results.
For example (copied from the manual 'How do I...' section)
How do I get the MAX(Order.ShippingDate - Order.OrderDate) value from a SPECIFIC customer's orders ?
SELECT MAX(Order.ShippingDate - Order.OrderDate) -> That's an expression
FROM Order
WHERE Order.CustomerId = 10 -> That's a filter
SelfServicing
// C#
OrderCollection orders = new OrderCollection();
int maxValue = (int)orders.GetScalar(OrderFieldIndex.OrderId, (OrderFields.ShippedDate - OrderFields.OrderDate),
(OrderFields.CustomerId == _customerId));
' VB.NET
Dim orders As New OrderCollection()
Dim filter As IPredicate = New FieldCompareValuePredicate(OrderFields.CustomerId, ComparisonOperator.Equal, _customerId)
Dim subExpression As New Expression(OrderFields.ShippedDate, ExOp.Sub, OrderFields.OrderDate)
Dim maxValue = CInt(orders.GetScalar(OrderFieldIndex.OrderId, subExpression, AggregateFunction.Max, filter))
' which is equal to (VB.NET 2005)
Dim orders As New OrderCollection()
Dim maxValue = CInt(orders.GetScalar(OrderFieldIndex.OrderId, (OrderFields.ShippedDate - OrderFields.OrderDate), _
(OrderFields.CustomerId = _customerId)))
Adapter
// C#
DataAccessAdapter adapter = new DataAccessAdapter();
int maxValue = (int)adapter.GetScalar(OrderFields.OrderId, (OrderFields.ShippedDate - OrderFields.OrderDate),
AggregateFunction.Max, (OrderFields.CustomerId == _customerId));
' VB.NET
Dim adapter As New DataAccessAdapter()
Dim filter As IPredicate = New FieldCompareValuePredicate(OrderFields.CustomerId, Nothing, ComparisonOperator.Equal, _customerId)
Dim subExpression As New Expression(OrderFields.ShippedDate, ExOp.Sub, OrderFields.OrderDate)
Dim maxValue As Integer = CInt(adapter.GetScalar(OrderFieldIndex.OrderId, subExpression, _
AggregateFunction.Max, filter))
' Which is equal to (VB.NET 2005)
Dim adapter As New DataAccessAdapter()
Dim maxValue As Integer = CInt(adapter.GetScalar(OrderFieldIndex.OrderId, (OrderFields.ShippedDate - OrderFields.OrderDate), _
AggregateFunction.Max, (OrderFields.CustomerId == _customerId)))
Please check the reference manual for the correct GetScalar overload you want to use.
And watch out for the parameters list. (The one you were trying to use had wrong parameters order)