Bug Report T294858
Visible to All Users

Summary values are calculated incorrectly when ICollectionView is used and a grid column contains null values

created 9 years ago (modified 9 years ago)

Is not displayed, the amount of salt, where in the first line of the Null. Of course you can display in the "0", but this would harm readability.

XAML
<dxg:GridControl x:Name="gc_qry_ivid_users_report_selected_objects_list" EnableSmartColumnsGeneration="True" ItemsSource="{Binding Source={StaticResource qry_iVid_users_report_selected_objects_listViewSource}, Mode=OneWay}" SelectionMode="Row" FontFamily="{StaticResource CW_font}" FontSize="11" PreviewMouseDoubleClick="GridControl_PreviewMouseDoubleClick" PreviewKeyDown="GridControl_PreviewKeyDown">               <dxg:GridControl.Columns>                   <dxg:GridColumn FieldName="object_name" Header="Project" Width="200" IsSmart="True" AllowEditing="False"/>                   <dxg:GridColumn FieldName="Class" Header="Cls" Width="40" IsSmart="True" AllowEditing="False"/>                   <dxg:GridColumn FieldName="existing" Header="Existing" Width="100" IsSmart="True" AllowEditing="False">                       <dxg:GridColumn.EditSettings>                           <dxe:TextEditSettings MaskType="Numeric" MaskUseAsDisplayFormat="True" Mask="# ### ###" MaskCulture=""/>                       </dxg:GridColumn.EditSettings>                   </dxg:GridColumn>                   <dxg:GridColumn FieldName="under_construction" Header="U/C" Width="100" IsSmart="True" AllowEditing="False">                       <dxg:GridColumn.EditSettings>                           <dxe:TextEditSettings MaskType="Numeric" MaskUseAsDisplayFormat="True" Mask="# ### ###" MaskCulture=""/>                       </dxg:GridColumn.EditSettings>                   </dxg:GridColumn>                   <dxg:GridColumn FieldName="planned" Header="Planned" Width="100" IsSmart="True" AllowEditing="False">                       <dxg:GridColumn.EditSettings>                           <dxe:TextEditSettings MaskType="Numeric" MaskUseAsDisplayFormat="True" Mask="# ### ###" MaskCulture=""/>                       </dxg:GridColumn.EditSettings>                   </dxg:GridColumn>                   <dxg:GridColumn FieldName="total_vacancy" Header="Vacancy" Width="100" IsSmart="True" AllowEditing="False">                       <dxg:GridColumn.EditSettings>                           <dxe:TextEditSettings MaskType="Numeric" MaskUseAsDisplayFormat="True" Mask="# ### ###" MaskCulture=""/>                       </dxg:GridColumn.EditSettings>                   </dxg:GridColumn>               </dxg:GridControl.Columns>               <dxg:GridControl.TotalSummary>                   <dxg:GridSummaryItem SummaryType="Count" ShowInColumn="object_name" DisplayFormat="{}{0:Number of projects=# ###}"/>                   <dxg:GridSummaryItem FieldName="existing" SummaryType="Sum" ShowInColumn="existing" DisplayFormat="{}{0:# ###}"/>                   <dxg:GridSummaryItem FieldName="under_construction" SummaryType="Sum" ShowInColumn="under_construction" DisplayFormat="{}{0:# ###}"/>                   <dxg:GridSummaryItem FieldName="planned" SummaryType="Sum" ShowInColumn="planned" DisplayFormat="{}{0:# ###}"/>                   <dxg:GridSummaryItem FieldName="total_vacancy" SummaryType="Sum" ShowInColumn="total_vacancy" DisplayFormat="{}{0:# ###}"/>               </dxg:GridControl.TotalSummary>               <dxg:GridControl.View>                   <dxg:TableView AllowPerPixelScrolling="True" ShowTotalSummary="True">                       <dxg:TableView.FormatConditions>                           <dxg:DataBarFormatCondition FieldName="existing">                               <dxg:DataBarFormatCondition.Format>                                   <dx:DataBarFormat Fill="{StaticResource CW_Existing_gradient}"/>                               </dxg:DataBarFormatCondition.Format>                           </dxg:DataBarFormatCondition>                           <dxg:DataBarFormatCondition FieldName="under_construction">                               <dxg:DataBarFormatCondition.Format>                                   <dx:DataBarFormat Fill="{StaticResource CW_UC_gradient}"/>                               </dxg:DataBarFormatCondition.Format>                           </dxg:DataBarFormatCondition>                           <dxg:DataBarFormatCondition FieldName="planned">                               <dxg:DataBarFormatCondition.Format>                                   <dx:DataBarFormat Fill="{StaticResource CW_Planned_gradient}"/>                               </dxg:DataBarFormatCondition.Format>                           </dxg:DataBarFormatCondition>                           <dxg:DataBarFormatCondition FieldName="total_vacancy">                               <dxg:DataBarFormatCondition.Format>                                   <dx:DataBarFormat Fill="{StaticResource CW_Vacancy_gradient}"/>                               </dxg:DataBarFormatCondition.Format>                           </dxg:DataBarFormatCondition>                       </dxg:TableView.FormatConditions>                   </dxg:TableView>               </dxg:GridControl.View>           </dxg:GridControl>
Show previous comments (2)

    It's hard for me to fix the example, I'm not that experienced. I will try to describe key points:
    1.The data source is a query with MS SQL server. An example of his work .png. When applied to digital data ISNULL(existing,0), then the problem is removed.
    2. For communication with MS SQL is used ADO.NET EF.
    3. XAML:
       <Window.Resources>
           <CollectionViewSource x:Key="qry_iVid_users_report_selected_objects_listViewSource" d:DesignSource="{d:DesignInstance {x:Type iVid:qry_iVid_users_report_selected_objects_list}, CreateList=True}"/>
       </Window.Resources>
    4. C#
               System.Windows.Data.CollectionViewSource qry_iVid_users_report_selected_objects_listViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("qry_iVid_users_report_selected_objects_listViewSource")));
               qry_iVid_users_report_selected_objects_listViewSource.Source = App.Industrial_DB.qry_iVid_users_report_selected_objects_list.Where(p => p.polygon_id == Selected_polygon_id).OrderBy(p=> p.object_name).ToList();

    DevExpress Support Team 9 years ago

      Hi Alexander,
      Thank you for your clarification. It appears that this issue can be reproduced with ICollectionView and related to our summary calculation mechanism. I will inform our developers about this issue. They will research if this issue can be fixed. We will let you know once we have any results.
      As a quick solution, set the grid's ItemsSource to the DbSet<TEntity>.Local collection.

        Thank you. I'll wait. While I will use a modified query.

        Answers approved by DevExpress Support

        created 9 years ago

        We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

        Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.