質問

I got a ClientDataset that has three aggregate fields. The aggregates calculate, amongst others, the total ordered amount per customer, so they use an index on the customer ID.

I use this ClientDataset for a report (FastReports), which displays all customers and their orders, grouped per customer and sorted by order date.

Therefore, I have two indexes on the ClientDataSet, one on CustomerId (for the grouping and aggregate fields), and one on CustomerId+OrderDate (for the sorting).

Now, when I choose the sorting index for the client dataset, the aggregates don't work anymore and return empty values in my report. They only work if I choose the grouping index for the ClientDataset itself, even though each individual aggregate already uses the right index.

I'd very much like this to work, because I will either have to write a lot of extra code, or adjust my report (I want to display the totals on top of each group, so the FR SUM expression won't work well either).

役に立ちましたか?

解決

I think I figured it out. I don't need the separate grouping index at all. I can just use the sorting index and set the grouping level on both the index and the aggregate fields to 1.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top