Show/Hide Toolbars

TMS Aurelius Documentation

There are several methods in TProjections class that create a projection that represents an aggregated function over a property value (or a projection). Available methods are:

 

Sum: Calculated the sum of values

Min: Retrieves the minimum value

Max: Retrieves the maximum value

Avg: Calculates the average of all values

Count: Retrieves the number of objects the satisfy the condition

 

Calculates the sum of all estimates where the customer name beings with "M".

 

Value := Manager.Find<TEstimate>
  .Select(Linq['EstimateNo'].Sum)
  .CreateAlias('Customer''c')
  .Where(Linq['c.Name'].Like('M%'))
  .UniqueValue;

 

Alternative way to write the same query:

 

Value := Manager.Find<TEstimate>
  .Select(TProjections.Sum('EstimateNo'))
  .CreateAlias('Customer''c')
  .Where(Linq['c.Name'].Like('M%'))
  .UniqueValue;