KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Using the column sums in another table? #2888

Closed Richb201 opened this topic on on Nov 29, 2022 - 6 comments

Richb201 commented on Nov 29, 2022

I have displayed 4 related tables appearing on my report. Each consists of a number of rows. When defining the columns, I sum the last column of each by using this in the footer text:

        "qualified_dollars"=>array(
            "cssStyle"=>"text-align:right",
            "prefix"=>"$",
            "footer"=>"sum",
            "footerText"=>"<b>Total Wages Qualified:</b> @value"
        )

I'd like to create another table to display such as this


                                    Method A                                     Method B
total wages qualified:    $200                                             $500
supplies:                        $300                                             $300
rental                             $120                                             $120  
TOTAL                           $620                                             $920

Here is how I build the supplies datastore:

        $this->src('substantiator')
            ->query("SELECT supply, description,  cost,  taxyear, project, business_component
                    FROM supplies 
                    WHERE campaign='$campaign' AND email='$email'"
                    )
            ->pipe($this->dataStore("supplies"));

All of these amounts in these two columns (Method A and Method B) come from @value of the related displayed tables. How can I accomplish this?

Richb201 commented on Nov 29, 2022

I guess the question is how do i get the subtotals calculated on one report and stuff those values into a different mysql table in the view file?

Richb201 commented on Nov 30, 2022

The way the data sits in mysql table is that all 10 fields are in a single row. I want to arrange it like this in a report. Can you give me an idea of what package to use and best practice to accomplish this?

Richb201 commented on Dec 1, 2022

I guess I am looking at Pivot?

Sebastian Morales commented on Dec 1, 2022

In my opinion, this looks like data structure resulted from either Cube or Pivot process. Pls try them and let us know your finding. Tks,

Richb201 commented on Dec 1, 2022

Thx. Cube has possibilities. I have a temporary tables I created called temp and it has all the information I need to display in a single row. But the data needs to be transposed. For example I have WagesA and WagesB and SuppliesA and SuppliesB, etc all on the same row in the table.





__wages__      WagesA   WagesB      avgWages
__supplies__   SuppliesA SuppliesB   avgSupplies

This is more of a presentation issue. Should I NOT be using a Koolreport report for this section? Is there a way to just place these amounts (WagesA and WagesB) in a square format as I would do with Excel? Can I do this with the Excel widget?

Sebastian Morales commented on Dec 6, 2022

If you already had a table of final data that only needs transposed we have Transpose and Tranpose2 processes which could help. Pls try them to see if they get you the result you want.

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

None