Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
675
Performance problem on Summary Column with a formula
posted

Hi Mike,

 I have a performance problem when I add a Formula on 6 static columns and 10 dynamic columns. When I change a value in my grid it tooks 5 seconds to the grid to update the total of the actual column. So before I can change or enter a new value in another column I always have to wait 5 seconds which is to long. If a deactivate those Summary column then if a change a value in the grid it took less the 1 second. I send you my code that create the formula.I use a formula because in certain columns there are some value that I dont want to summarize. So in the formula I substract this value to obtain the result that i want. The total value per colum that I  have to substract are in the DataTableTermePoGroupByYearAndMonth object which is a DataTable that I convert later on in a DataView to filter on a specific month

Is there something I do wrong that can explain why it is so long to update the value into the summary column?

Thanks in advance !

Private Sub gridGestionProjetExecution_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles gridGestionProjetExecution.InitializeLayout

m_DataTableTermePoGroupByYearAndMonth.Clear()

' On récupère les données des termes de Po groupés par année et mois et les déposes son dataTable

m_DataTableTermePoGroupByYearAndMonth = CGestionPrjInfragistic.GetTermesPOGroupByYearAndMonth(CodeProjet, m_gridStartDate)

' On assigne le CalcManager qui est nécessaire si on utilise lne formule pour la sommation de la colonne

gridGestionProjetExecution.CalcManager = myCalcManager

gridGestionProjetExecution.DisplayLayout.ViewStyle = ViewStyle.MultiBand

 

' Formula is created in this Sub routine (see lower for the code of this sub routine)

CalculerTotalColonnesSansTermesPo()      

 

'' Set the appearance of the summary footer area.

Me.gridGestionProjetExecution.DisplayLayout.Override.SummaryFooterAppearance.FontData.Bold = DefaultableBoolean.True

Me.gridGestionProjetExecution.DisplayLayout.Override.SummaryFooterAppearance.BackColor = Color.White

Me.gridGestionProjetExecution.DisplayLayout.Override.SummaryFooterAppearance.ForeColor = Color.Black

'' Set the appearance for the caption on top of th summary area.

Me.gridGestionProjetExecution.DisplayLayout.Override.SummaryFooterCaptionVisible = DefaultableBoolean.True

Me.gridGestionProjetExecution.DisplayLayout.Override.SummaryFooterCaptionAppearance.BackColor = Color.DarkBlue

Me.gridGestionProjetExecution.DisplayLayout.Override.SummaryFooterCaptionAppearance.ForeColor = Color.White

gridGestionProjetExecution.DisplayLayout.Bands(BAND_NAME_ROOT).SummaryFooterCaption = "Sommaire :"

End Sub

 

 

Private Sub CalculerTotalColonnesSansTermesPo()

' Déclaration des variables

Dim iTotalPoTermeToSubstract As Int32 = 0

Dim iTotalAllPoTermeToSubstract As Int32 = 0

Dim myViewTermeGroupByYearAndMonth As DataView = New DataView(m_DataTableTermePoGroupByYearAndMonth)

myViewTermeGroupByYearAndMonth.RowFilter = "Mois = -999999999"

iTotalAllPoTermeToSubstract = 0

If myViewTermeGroupByYearAndMonth.Count > 0 Then

' -999999999 est l'identifiant unique pour le mois que j'ai donné pour récupérer le total de tous les mois

iTotalAllPoTermeToSubstract = CType(myViewTermeGroupByYearAndMonth.Item(0).Item("Valeur"), Int32)

End If

 

' on se crée une variable de la bande sur laquelle on veux travailler

Dim myBand As UltraGridBand = gridGestionProjetExecution.DisplayLayout.Bands(BAND_NAME_ROOT)

'************************************************************************************************************************************************

' Ici on simule une sommation car dans les faits il en est rien.

'* On ne fait qu'utiliser la colonne description pour afficher une description par ligne de sommation

'************************************************************************************************************************************************

myBand.Summaries.Add(COL_NAME_DESCRIPTION, SummaryType.Sum, myBand.Columns(COL_NAME_DESCRIPTION), SummaryPosition.UseSummaryPositionColumn)

myBand.Summaries(COL_NAME_DESCRIPTION).SummaryDisplayArea = SummaryDisplayAreas.BottomFixed

myBand.Summaries(COL_NAME_DESCRIPTION).DisplayFormat = "Total coûtants :"

myBand.Summaries(COL_NAME_DESCRIPTION).Appearance.TextHAlign = HAlign.Right

 

'************************************************************************************************************************************************

' Ici on cumule les totaux de la grille pour les colonnes de gauche en supprimant les total des Termes de Po pour la colonne ImputationFutures

'************************************************************************************************************************************************

myBand.Summaries.Add(COL_NAME_BUDGET_REVISE, SummaryType.Sum, myBand.Columns(COL_NAME_BUDGET_REVISE), SummaryPosition.UseSummaryPositionColumn)

myBand.Summaries(COL_NAME_BUDGET_REVISE).SummaryDisplayArea = SummaryDisplayAreas.BottomFixed

myBand.Summaries(COL_NAME_BUDGET_REVISE).DisplayFormat = "{0}"

myBand.Summaries(COL_NAME_BUDGET_REVISE).Appearance.TextHAlign = HAlign.Right

' ''La colonne Cumulatif imputé

myBand.Summaries.Add(COL_NAME_CUMULATIF_IMPUTE, SummaryType.Sum, myBand.Columns(COL_NAME_CUMULATIF_IMPUTE), SummaryPosition.UseSummaryPositionColumn)

myBand.Summaries(COL_NAME_CUMULATIF_IMPUTE).SummaryDisplayArea = SummaryDisplayAreas.BottomFixed

myBand.Summaries(COL_NAME_CUMULATIF_IMPUTE).DisplayFormat = "{0}"

myBand.Summaries(COL_NAME_CUMULATIF_IMPUTE).Appearance.TextHAlign = HAlign.Right

 

' ''La colonne Cumulatif imputé Reconnu comme avancement

myBand.Summaries.Add(COL_NAME_CUMULATIF_IMPUTE_RECONNU_AVANC, SummaryType.Sum, myBand.Columns(COL_NAME_CUMULATIF_IMPUTE_RECONNU_AVANC), SummaryPosition.UseSummaryPositionColumn)

myBand.Summaries(COL_NAME_CUMULATIF_IMPUTE_RECONNU_AVANC).SummaryDisplayArea = SummaryDisplayAreas.BottomFixed

myBand.Summaries(COL_NAME_CUMULATIF_IMPUTE_RECONNU_AVANC).DisplayFormat = "{0}"

myBand.Summaries(COL_NAME_CUMULATIF_IMPUTE_RECONNU_AVANC).Appearance.TextHAlign = HAlign.Right

' ''La colonne Reste à imputer

myBand.Summaries.Add(COL_NAME_RESTE_A_IMPUTER, SummaryType.Sum, myBand.Columns(COL_NAME_RESTE_A_IMPUTER), SummaryPosition.UseSummaryPositionColumn)

myBand.Summaries(COL_NAME_RESTE_A_IMPUTER).SummaryDisplayArea = SummaryDisplayAreas.BottomFixed

myBand.Summaries(COL_NAME_RESTE_A_IMPUTER).DisplayFormat = "{0}"

myBand.Summaries(COL_NAME_RESTE_A_IMPUTER).Appearance.TextHAlign = HAlign.Right

 

' ''La colonne Imputation Future

myBand.Summaries.Add(COL_NAME_IMPUTATION_FUTURE, SummaryType.Formula, myBand.Columns(COL_NAME_IMPUTATION_FUTURE), SummaryPosition.UseSummaryPositionColumn)

myBand.Summaries(COL_NAME_IMPUTATION_FUTURE).SummaryDisplayArea = SummaryDisplayAreas.BottomFixed

myBand.Summaries(COL_NAME_IMPUTATION_FUTURE).DisplayFormat = "{0}"

myBand.Summaries(COL_NAME_IMPUTATION_FUTURE).Appearance.TextHAlign = HAlign.Right

myBand.Summaries(COL_NAME_IMPUTATION_FUTURE).Formula =
"Sum([" + COL_NAME_IMPUTATION_FUTURE + "]) - " & iTotalAllPoTermeToSubstract.ToString

' ''La colonne Delta

myBand.Summaries.Add(COL_NAME_DELTA, SummaryType.Sum, myBand.Columns(COL_NAME_DELTA), SummaryPosition.UseSummaryPositionColumn)

myBand.Summaries(COL_NAME_DELTA).SummaryDisplayArea = SummaryDisplayAreas.BottomFixed

myBand.Summaries(COL_NAME_DELTA).DisplayFormat = "{0}"

myBand.Summaries(COL_NAME_DELTA).Appearance.TextHAlign = HAlign.Right

'************************************************************************************************************************************************

' Ici on cumule les totaux de la grille pour les colonnes de droite en supprimant les total des Termes de Po par mois

'************************************************************************************************************************************************

For i As Integer = 1 To NombreDeMoisAAfficher

' On crée le type de sommation que l'on veut faire soit une formule

myBand.Summaries.Add(i.ToString, SummaryType.Formula, myBand.Columns(i.ToString), SummaryPosition.UseSummaryPositionColumn)

myViewTermeGroupByYearAndMonth.RowFilter =
"Mois = " & i.ToString

' Réinitialisation de la valeur à soustraire

iTotalPoTermeToSubstract = 0

' SI on a une valeur a soustraire pour la colonne courante

If myViewTermeGroupByYearAndMonth.Count > 0 Then

iTotalPoTermeToSubstract = CType(myViewTermeGroupByYearAndMonth.Item(0).Item("Valeur"), Int32)

End If

' Ici bottomFixed veut dire que la ligne des totaux sera toujours visible dans le bas de la grille

myBand.Summaries(i.ToString).SummaryDisplayArea = SummaryDisplayAreas.BottomFixed

myBand.Summaries(i.ToString).DisplayFormat = "{0}"

myBand.Summaries(i.ToString).Appearance.TextHAlign = HAlign.Right

myBand.Summaries(i.ToString).Formula =
"Sum([" + i.ToString + "]) - " & iTotalPoTermeToSubstract.ToString

Next

End Sub

 

 

Parents Reply Children