Get item table, each element and add a new item
I need to get the data/rows to be displayed in a table component, traverse it and add a new row that is the result of the sum of values when traversing the data/rows. Is it possible?
7 Replies
π
Thanks, it is an option but analyzing the queries duplicates them and the base query is heavy. That is the reason to go through the records given by the query.
sorry, I don't understand what you mean π
I think he wants to php loop through the records.
When actually he likely want's to just add indexes so the queries are faster.
When you use summaries, what you do is apply a sum to the base query. If you analyze for example the requests with telescope you can see that it will make a query such as select * from games and if you apply a summaries to prize you also execute select sum(prize) from games.
I have created the necessary indexes but it is a report whose data is obtained through a query that has different joins between sql tables.
i want to add a footer to my table making a loop in php to get the total without using summarize because of duplicity of queries.
π
You know you can provide your own query with a custom summerizer right? https://filamentphp.com/docs/3.x/tables/summaries#custom-summaries