2

I'm using Delphi XE5 and i have a firedac query (FDQuery) with three columns: (Account, value, Vendor) and i need sum the value field per Account on TAggregateField. The same account can have many vendors.

Account | Value | Vendor
1       | 100.00| Joe
1       | 100.00| Max
2       | 500.00| Wily

So, can i sum the value field getting distinct Account (total value: 600,00 not 700,00) without sort or filter the FDQuery?

What have I tried? In design mode, I created an aggregate field named "AggAccountsTotal" with the following properties:

Expression = 'sum(value)';
Active = True

...and created a TFDIndex with the following properties:

Distinct = True
Name = idxsumAccountvalue
Fields = Account
Active = True

However, when you enable FDQuery aggregate fields and try to set the IndexName property in the aggregate field (not FDQUEry), it does not appear in the combobox. If you manually assign the name, the following error occurs:

Access violation at address 1419398F in module 'FireDACCommon190.bpl'. Read of address 00000020.

This is the error screenshot

Is this behavior expected and am I doing something wrong or is delphi / Firedac Bug?

AnselmoMS
  • 467
  • 3
  • 18

0 Answers0