Hi,
I have a windGrid multiband
The first band is call root. In this root band there are always only 2 rows
My goal is to do a summary on each column but only on the First rows of the root band
Actualy both rows are summaries which is not the result that i would like to do.
Is it possible by programmation to add a condition to filter all the second row of the band root
All first row have a color as backgroud in each cells and all the second row are white as background
Thanks in advance !
I'm afraid I am having a hard time understanding exactly what you want. Are you talking about a summary applied to the root band or to the child bands?
Do you simply want to hide the second row on the root band?
You might need to use a CustomSummaryCalculator and calculate the summary value yourself. But it's hard to say if there is any easier way without really understanding exactly what you are trying to acheive.
Yes I am talking about a summary on the Root band only
I also have Child band but I dont summaries them and this work
My Root band is also summaries.
My goal is to summary all columns but only the first row of the Band root but in each root band we have 2 rows
and actualy all rows are summaries which is the defaut behavior.
I have a invisible columns LineType that indicate me if the actual row is the first or second row
So if the invisible columns LineType=1 then summarise the values
LineType ColumnsA ColumnsB
1 10 20
2 5 11
Summary 10 20 <== (This is what i would like to have as a result)
Actualy I have 15 31 <== (This is what i have as a result)
Is there a way or a condition in a formula that I can summaries only the linetype 1?
Thanks in advance! :)
Hi again,
I try your suggestion but no total appears in the summary row.
May be there is something wrong or that i dont understand.
The first scenario is when I use the formula with out the UltraCalcManager
Dim strFormula As String
gridGestionProjetExecution.DisplayLayout.Bands(BAND_NAME_ROOT).Summaries.Add(i.ToString, SummaryType.Formula, gridGestionProjetExecution.DisplayLayout.Bands(BAND_NAME_ROOT).Columns(i.ToString), SummaryPosition.UseSummaryPositionColumn)
gridGestionProjetExecution.DisplayLayout.Bands(BAND_NAME_ROOT).Summaries(i.ToString).SummaryDisplayArea = SummaryDisplayAreas.BottomFixed
gridGestionProjetExecution.DisplayLayout.Bands(BAND_NAME_ROOT).Summaries(i.ToString).DisplayFormat = "{0}"
gridGestionProjetExecution.DisplayLayout.Bands(BAND_NAME_ROOT).Summaries(i.ToString).Appearance.TextHAlign = HAlign.Right
' Here I tried those 4 combination of syntax and nothing appears in the summary row
'strFormula = "[\\gridGestionProjetExecution\" + BAND_NAME_ROOT + "(0)\" + i.ToString & "]"
'strFormula = "[//gridGestionProjetExecution/" + BAND_NAME_ROOT + "(0)/" + i.ToString & "]"
'strFormula = "[//gridGestionProjetExecution/" + BAND_NAME_ROOT + "/" + i.ToString & "(0)]"
strFormula = "[\\gridGestionProjetExecution\" + BAND_NAME_ROOT + "\" + i.ToString & "(0)]"
gridGestionProjetExecution.DisplayLayout.Bands(BAND_NAME_ROOT).Summaries(i.ToString).Formula = strFormula
Next
The second Scenario is with the UltraCalcManager
e.Layout.ViewStyle = ViewStyle.MultiBand
e.Layout.Grid.CalcManager = calcManager
' Here I tried those 4 combination of syntax and I received thoses error messages
Error Message with this syntax : "Key Already Exist"
'e.Layout.Bands(BAND_NAME_ROOT).Columns(i.ToString).Formula = "[\\gridGestionProjetExecution\" + BAND_NAME_ROOT + "(0)\" + i.ToString + "]"
'e.Layout.Bands(BAND_NAME_ROOT).Columns(i.ToString).Formula = "[\\gridGestionProjetExecution\" + BAND_NAME_ROOT + "\" + i.ToString + "(0)]"
'e.Layout.Bands(BAND_NAME_ROOT).Columns(i.ToString).Formula = "[\\gridGestionProjetExecution\" + BAND_NAME_ROOT + "\" + i.ToString + "]"
Error Message with this syntax : "A formula Circularity has been detected in the formulaNo calculations can be performes by the CalcEngine while a Circularity exists"
e.Layout.Bands(BAND_NAME_ROOT).Summaries.Add("Summary1", "sum( [" + i.ToString + "] )")
Do you have an idea of the problem ?
Do I have to use the UltraCalcManager?
Thanks in advance
yannh said:Do I have to use the UltraCalcManager?
Yes, you have to have an UltraCalcManager in order to use Formulas.
The error message you have listed here don't make any sense. A "Key Already Exists" message indicates that you are attempting to add an item to a collection with a key that already exists in the collection. So you need to find out what you are adding and make sure it has a unique key.
The circularity error means that you have two formulas that point to each other in an infinite loop.
Ok I finaly arrive to use the formula "Sum([ColumnsA(0)])" with the UltraCalcManager but the result is not what a was looking for. The actual result summarize only the first row of the Band root of the entire grid.
root LineType ColumnsA ColumnsB
root 1 7 5
2 15 8
Total 17 25 <== (This is what i would like to have as a result)
Actualy I have 10 20 <== (This is what i have as a result)
The total summarize only the first row of the root band but of the first row of the grid only
My goal is to summarize all values of the root band where linetype=1
Is that possible?
Okay, that's a different story.
There are several ways to do this.
1) If you group by the LineType column, then the summaries will be broken up automatically into each group.
2)You could add an unbound column to the for each LineType and set the Formula of that column to use an 'if' function. Basically, the unbound column's formula would be something like this:
if ( [LineType] = 1, [ColumnsA], 0 )
Then you could sum this unbound column to get the sum of everything in ColumnsA where LineType is 1.
3) You could use a CustomSummaryCalculator and do the calculations yourself.
Hi Mike,
I finaly obtain the result I want with the CustomSummaryCalculator
The problem I got now is that when I change a value in my grid it took around 20 second to update all the summary columns
This is the way I use the CustomSummaryCalculator and I implement the CTotalSummaryWithOutPoTerms class with the condition I want in it
Is there something I can do to optimise the calculation?
I dont use any CalcManager . Is that the raison of my problem?
For i As Integer = 1 To NumberOfcolumnToShow
myBand.Summaries.Add(i.ToString, SummaryType.Custom, New CTotalSummaryWithOutPoTerms(i.ToString), myBand.Columns(i.ToString), SummaryPosition.UseSummaryPositionColumn, Nothing)
myBand.Summaries(i.ToString).SummaryDisplayArea = SummaryDisplayAreas.BottomFixed
myBand.Summaries(i.ToString).DisplayFormat = "{0}"
myBand.Summaries(i.ToString).Appearance.TextHAlign = HAlign.Right
End Sub
Well, it's hard for me to suggest any ways you might optimize the sumaries, since you didn't include the code for your CustomSummaryCalcuator here.
UltraCalcManager summaries are calculated asynchronously (by default), so you might get more responsive UI using CalcManager instead.