Hi all,
I'd like to allow the user to build their own formula for a new Summary in a WinGrid. Currently, the user can select a column for the summary to be placed under, create a new formula using the FormulaBuilder dialog, and this adds a new summary with the specified formula, under the selected column.
In addition to this, a report is generated from the grid which is also required to display these formulas as they are in the grid. (I use the GridDocumentExporter for this)
I have two problems which are both specific to summaries placed at each Group level. The Grand Summary level displays the correct value, as desired, however...
These issues seem linked, but I still can't figure out what is wrong...
When creating the summaries I pass the FormulaBuilder a new summary as an IFormulaProvider. When the user has successfully specified a formula, this is applied to the Formula property of the Summary.
The summary used is what is returned from this (SummarySettings object):
Summaries.Add(formulaId,
SummaryType.Formula, column, SummaryPosition.UseSummaryPositionColumn);
"formulaId" is a string and "column" is an UltraGridColum in the Grid.
Any ideas would be greatly appreciated!
Cheers,
Richard
Hi Richard,
That sounds like it's correct. The grid band has to have a Key in order to be referenced by the CalcManager formulas and the band gets it's Key from the data source.
Hi Mike,
Thanks for the reply! I've now resolved the problem. The only difference between the two tables was that one was named and the other wasn't. After setting a name for the other table it all worked peachy!
I'm not sure if this is a bug or feature but either way it's all resolved now! Thanks for you help! =D
The type of data source you are using for the back end can't have any direct effect on formulas or the grid. The grid only deals with the local DataSource.
Of course, the type of data source you are using might have an effect on the DataTypes of the fields in the grid and there could be a problem there. But I don't know off the top of my head of any types that simply don't work. It depends on the formula and the functions used, anyway.
Why don't you loop through the columns in your grid and display the DataType property on each column and see if there are any unusual types listed.
1/2 Solved...
We've finally updated to the most recent version (9.2) and that has not solved the issue. However, invoking the RefreshSorts(true) method of the (Grid).DisplayLayout.Bands[0].SortedColumns property. My understanding is this simply reapplies all the existing groups. There doesn't seem to any significant performance hits/flickering etc. so this will suffice.
This solves the first issue and the second issue is actually a problem with the data source we are using and not specifically to do with the formulas it appears. The grid will always work off one of two data sources: One is a DataTable populated from data stored in an XML file and the other is populated from data from another source e.g. an Access database.
Has anyone else have this problem/know of any properties in a DataTable object that may cause this problem (formulas not being calculated at group level in a report generated from the grid)? Or maybe certain data types not working correctly?
If anyone has any more help, it'd be greatly appreciated.
I've been informed we're using a slightly older version of Infragistics; version 9.1.(somethingorother). As opposed to the most recent, 9.2.
I'll look at apply that update and let you know of any success.