© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•6d ago•
4 replies
Vp

Export with aggregating relationship (sum)

✅ SolvedPanels5️⃣v5
On table I display like below which is working fine
⁨⁨
TextColumn::make('items_sum_actual_weight_value')
    ->sum('items', 'actual_weight_value')
    ->label('Total Weight')
TextColumn::make('items_sum_actual_weight_value')
    ->sum('items', 'actual_weight_value')
    ->label('Total Weight')
⁩⁩

But when I try to export, I got error ⁨⁨
Undefined array key "items_sum_actual_weight_value"
Undefined array key "items_sum_actual_weight_value"
⁩⁩, below is how I put in exporter
⁨⁨
ExportColumn::make('items_sum_actual_weight_value')
    ->sum('items', 'actual_weight_value')
    ->label('Total Weight'),
ExportColumn::make('items_sum_actual_weight_value')
    ->sum('items', 'actual_weight_value')
    ->label('Total Weight'),
⁩⁩

And I also have this modify query like this comment Exporting a sorted sum column with ExportAction

⁨⁨
public static function modifyQuery(Builder $query): Builder
{
    return $query
        ->withSum('items', 'actual_weight_value')
        ->withCount('items');
}
public static function modifyQuery(Builder $query): Builder
{
    return $query
        ->withSum('items', 'actual_weight_value')
        ->withCount('items');
}
⁩⁩

So, what should be the problem here?
Solution
welp, silly me.. I forgot to restart queue:work after changing something
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Sum relationship
FilamentFFilament / ❓┊help
2y ago
export sum at the end
FilamentFFilament / ❓┊help
15mo ago
Group sum summarie with query scope, not working
FilamentFFilament / ❓┊help
2y ago
How to Sum relationship column with cast field
FilamentFFilament / ❓┊help
15mo ago