Sum of detail databand where master has filter

Stimulsoft Reports.Net discussion
Post Reply
Tobias
Posts: 93
Joined: Mon Nov 24, 2008 8:44 am

Sum of detail databand where master has filter

Post by Tobias » Tue May 07, 2019 2:56 pm

Simple scenario having two data-sources in a master/detail-relation.

What I want is to have a master and a detail databand TWICE on a page, with each master band having a different filter condition. Now I also want a footer for each master band that sums all values from the detail band.

It works with one master+detail band pair, but not with two. I then get an error.

Please see the attached example.
Attachments
Report.mrt
(13.1 KiB) Downloaded 7 times
Lech Kulikowski
Posts: 1515
Joined: Tue Mar 20, 2018 5:34 am

Re: Sum of detail databand where master has filter

Post by Lech Kulikowski » Wed May 08, 2019 9:04 am

Hello,

Could you provide more detailed information or a sample which result do you need?

Thank you.
Tobias
Posts: 93
Joined: Mon Nov 24, 2008 8:44 am

Re: Sum of detail databand where master has filter

Post by Tobias » Wed May 08, 2019 9:49 am

See the above example. The data looks like this:

Code: Select all

{
  "Foos": [
    {
      "Id":  1, 
      "Name": "Foo #1",
      "Type": "foo",
      "Values": [
        {
          "ParentId": 1,
          "Name": "Value #1",
          "Amount": 1.00
        },
        {
          "ParentId": 1,
          "Name": "Value #2",
          "Amount": 2.00
        }
      ]
    },
    {
      "Id": 2,
      "Name": "Foo #2",
      "Type": "bar",
      "Values": [
        {
          "ParentId": 2,
          "Name": "Value #1",
          "Amount": 3.00
        },
        {
          "ParentId": 2,
          "Name": "Value #2",
          "Amount": 4.00
        }
      ]
    },
    {
      "Id": 3,
      "Name": "Foo #3",
      "Type": "foo",
      "Values": [
        {
          "ParentId": 3,
          "Name": "Value #1",
          "Amount": 5.00
        },
        {
          "ParentId": 3,
          "Name": "Value #2",
          "Amount": 6.00
        }
      ]
    }
  ]
}
And I would like to see an output like this:

Code: Select all

// "Foos" filterd by "Type == 'foo'"
Foo #1
  Value #1    1.00
  Value #2    2.00
Foo #3
  Value #1    5.00
  Value #2    6.00
===================
             14.00  // <- SUM of above values
			 

// "Foos" filterd by "Type == 'bar'"
Foo #2
  Value #1    3.00
  Value #2    4.00
===================
              7.00 // <- SUM of above values
Lech Kulikowski
Posts: 1515
Joined: Tue Mar 20, 2018 5:34 am

Re: Sum of detail databand where master has filter

Post by Lech Kulikowski » Wed May 08, 2019 10:37 pm

Hello,

Please check the modified report.

Thank you.
Attachments
Report_modified.mrt
(11.39 KiB) Downloaded 7 times
Post Reply