Hello,
I have a XamDataGrid with fields/columns A, B and C. A and B are using summary definitions each with the default "Sum"-summary calculator set. For C I defined a third summary definition with a custom summary calculator where in the EndCalculation event I'am calculating a percentage value depending on the summaries A and B. The problem is, that I only can set one field as SourceFieldName per summary definition which I set to field C for the custom summary calculator. Now the EndCalculation event is just fired on changes of cells in field C. But I need it to be fired on changes of the cells in column A and B or just on their summary changes. How can I achieve this?
I have been looking into your question and I can suggest you use our XamCalculationManager in order to create custom summaries based on field values :
http://help.infragistics.com/Help/NetAdvantage/WPF/2012.2/CLR4.0/html/xamCalculationManager_Using_xamCalculationManager_with_xamDataGrid.html
If you need any further assistance on this matter, feel free to ask.
thanks for the hint. Using XamCalculationManager for summary calculations is a new feature of NetAdvantage 2012.2, right?! I tried it but the problem is it worked just for the grand summaries but not for the underlying group summaries. Am I missing something? See my code snippet of the 3 summary definitions I use:
<igDP:SummaryDefinition Key="Net2Summary"
SourceFieldName="Net2"
Calculator="Sum">
<igDP:SummaryDefinition.CalculationSettings>
<igDP:SummaryCalculationSettings ReferenceId="Net2Sum"/>
igDP:SummaryDefinition.CalculationSettings>
igDP:SummaryDefinition>
<igDP:SummaryDefinition Key="Gross3Summary"
SourceFieldName="Gross3"
<igDP:SummaryCalculationSettings ReferenceId="Gross3Sum"/>
<igDP:SummaryDefinition Key="PayfactorNet2Summary"
SourceFieldName="PayfactorNet2InPercent">
<igDP:SummaryCalculationSettings Formula="[Net2Sum] + [Gross3Sum]" ReferenceId="PFN2Sum"/>
Thank you for your reply. I have created a sample application(DataGridCustomSumCalculator.zip) where I have used Custom Summary Calculator in order to achieve the desired functionality.
thank you for your new sample but there you can see the problem I also had with the summar calculator solution: If you change a value in one of the used columns i.e. "Mileage" no update is happinging because the aggregate function of the summary calculator is not called.
You can use some other event like e.g. RecordUpdate. I am not sure how exactly your data in the XamDatagrid changes.
I don't know which event I should use. I think using record update will be called to often and could result in performance issues because we have a big data grid.
Is there maybe a summary changed event or anything similar? I'm thinking of catching the summary changed event of column A and B and recalling summary calculator of column C (which shows the result) manually in it. Would that be possible and if so, do have another sample for me?
I am just checking your progress on the issue.
If you require any further assistance please do not hesitate to ask.
We switched to refresh our summary definitions in the EditModeEnded and LostFocus event because LayoutUpdate was called to often and brought us performance issues.
Thanks for your help!
I am just checking if you require any further assistance on the matter.
Thank you for your feedback. I am glad that my suggestion is helpful. Regarding the XamCalculationManager it is not created to be a specific feature of the Row Summaries in the XamDataGrid. The xamCalculationManager control allows you to create complex formulas which can be reused among different controls :
http://help.infragistics.com/NetAdvantage/WPF/2012.2/CLR4.0/?page=xamCalculationManager_Getting_Started_with_xamCalculationManager.html
This is why the no checkbox appears in the group summaries.
Your workaround seems to work for me at the moment. Thanks for your help.
But could you check if it's a bug that there are no summaries in the group headers if you are using the calculation manager (see my second post). And if so, could you send it to your product team so that they can fix it? Otherwise using the calculation manager for summaries seems to be pretty useless.