Ticket T1255491
Visible to All Users
Duplicate

We have closed this ticket because another page addresses its subject:

Incorrect running summary is calculated if the affected XRControl is conditionally hidden

Incorrect RunningSum over Report with Group when not Visible in some Details

created 7 months ago

I have a Report with Groups and in some specific Details I want display a Running Sum over all Details.

I place a Label, configure the Running Sum, configure the Visible Property with an Expression.
From the 2nd Group the Label (SumB5) displays the wrong Value.

Actual Output:

Code
Group A 1:10 SumA1:10 2:10 SumA2:20 SumB2:20 3:10 SumA3:30 Group B 4:10 SumA4:40 5:10 SumA5:50 SumB5:40

Expected Output:

Code
Group A 1:10 SumA1:10 2:10 SumA2:20 SumB2:20 3:10 SumA3:30 Group B 4:10 SumA4:40 5:10 SumA5:50 SumB5:50
C#
[TestClass] public class UnitTest1 { public class Item { public int ID { get; set; } public string Group { get; set; } public decimal Price { get; set; } public int ShowRunningSum { get; set; } } [TestMethod] public void TestMethod1() { var data = new[] { new Item {ID = 1, Group="A", Price = 10}, new Item {ID = 2, Group="A", Price = 10, ShowRunningSum=1}, new Item {ID = 3, Group="A", Price = 10}, new Item {ID = 4, Group="B", Price = 10}, new Item {ID = 5, Group="B", Price = 10, ShowRunningSum=1}, }; var rpt = new XtraReport { Bands = { new GroupHeaderBand { GroupFields = {new GroupField { FieldName = "Group" } }, Controls = { new XRLabel{ExpressionBindings = {new ExpressionBinding(nameof(XRLabel.Text), "'Group ' + [Group]") }} } }, new DetailBand { Controls = { new XRLabel{ExpressionBindings = {new ExpressionBinding(nameof(XRLabel.Text), "[ID] + ':' + [Price]")}}, // Running Report new XRLabel{ ExpressionBindings = { new ExpressionBinding(nameof(XRLabel.Text), "'SumA' + [ID] + ':' + sumRunningSum([Price])")}, Summary = new XRSummary{Running = SummaryRunning.Report}, LeftF = 100}, new XRLabel{ ExpressionBindings = { new ExpressionBinding(nameof(XRLabel.Text), "'SumB' + [ID] + ':' + sumRunningSum([Price])"), new ExpressionBinding(nameof(XRLabel.Visible), "[ShowRunningSum] == 1")}, Summary = new XRSummary{Running = SummaryRunning.Report}, LeftF = 200}, } } }, DataSource = data }; string reportText = ReportToText(rpt); Console.WriteLine(reportText); // <== generates the output above Assert.IsTrue(reportText.Contains("SumB2:20")); Assert.IsTrue(reportText.Contains("SumB5:50")); // <== Fails! } private static string ReportToText(XtraReport report) { using (var ms = new MemoryStream()) { report.ExportToText(ms); ms.Position = 0; using (var sr = new StreamReader(ms)) { return sr.ReadToEnd(); } } } }

Answers approved by DevExpress Support

created 7 months ago

Hello,

Thank you for reaching out to our support team.
I see the behavior you described. I created a public bug report for it: Incorrect running summary is calculated if the affected XRControl is conditionally hidden.
We will update that thread once we have results.

In the meantime, please share this information:

  • Could you please specify the affected platform (ASP.NET / WinForms / Blazor / WPF)?
  • Could you elaborate on this requirement? Why do you need to hide certain XRControls?

Best regards,
Boris

    Comments (2)

      Hallo Boris,

      thank you for your quick response and confirming this behavior as a bug.

      Answers to your questions:

      • We design the Reports with the WinForms Designer. The production runtime is hosted in a classic APS.NET in IIS and the development runtime in an owin host. But think this is not relevant for this bug, because the behavior comes from the Core. So I tried to Reproduce it without any designer or "runtime". Thats why I did not specified more specific than "Reporting" ;-)

      • In "reality" we have a Invoice/Offer report with many items. The user can insert special items which represents a subtotal. So only these specific subtotal Detail shall display the Running Sum. And the items are also grouped maybe by assembly or other criteria.
        The original report contains a few hundred fields. I reduced this situation to this minimal, abstract and testable example.

      Best regards,
      Daniel.

      Boris (DevExpress Support) 7 months ago

        Hi Daniel,

        Thank you for the detailed description.
        I asked about the platform because I wanted to check if there is some workaround to hide content manually in a finished document using Bricks, but since you're not using document viewer for WinForms, this is not an option.

        I can't give you any guarantees about a potential fix for this behavior, but I confirm that it's unexpected and we will look into it.

        Best regards,
        Boris

        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.