F
Filament10mo ago
anselm

Calculating columns and sums in a RelationManager

I'm using a RelationManager to show items belonging to an order. Each item has a price and amount . Next to the columns for Price and Amount, i'd like to display a column for the item total, e.g. price * amount. I found this tip https://v2.filamentphp.com/tricks/calculated-value-in-column which recommends using ->getStateUsing() on the TableColumn, but I always get an error Column not found: 1054 Unknown column 'order_items.total' in 'field list' which makes sense. Does this feature not work on a RelationManager Table? Is there another way to do it? I'd also like to display a sum for this column below the table. How would I achieve this? Since I'd need to multiply price and amount per item before summing. Thanks!
Filament
Calculated value in column by Juan Benitez - Tricks - Filament
Filament is a collection of tools for rapidly building beautiful TALL stack apps, designed for humans.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server