F
Filamentβ€’7mo 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
Euu83OPβ€’7mo ago
πŸ™
Euu83
Euu83OPβ€’7mo 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β€’7mo ago
sorry, I don't understand what you mean πŸ˜†
toeknee
toekneeβ€’7mo 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
Euu83OPβ€’7mo 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β€’7mo ago
You know you can provide your own query with a custom summerizer right? https://filamentphp.com/docs/3.x/tables/summaries#custom-summaries
Want results from more Discord servers?
Add your server