F
Filamentβ€’4w ago
Euu83

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
Euu83
Euu83β€’4w ago
πŸ™
Euu83
Euu83β€’4w ago
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.
Vp
Vpβ€’4w ago
sorry, I don't understand what you mean πŸ˜†
toeknee
toekneeβ€’4w ago
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.
Euu83
Euu83β€’3w ago
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. πŸ™
awcodes
awcodesβ€’3w ago
You know you can provide your own query with a custom summerizer right? https://filamentphp.com/docs/3.x/tables/summaries#custom-summaries