© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
5 replies
Garadit

Using column value or $state in other column

I have this column:

Tables\Columns\TextColumn::make('population.sample_size')
                ->label('Sample Size')
                ->sortable(),
Tables\Columns\TextColumn::make('population.sample_size')
                ->label('Sample Size')
                ->sortable(),


And I want to use that column values ​​or $state to do calculations on the other columns like this:

Tables\Columns\TextColumn::make('difference')
                ->label('Difference')
                ->getStateUsing(function ($record) {
                    return $record->respondent_count - $record->population->sample_size;
                })
                ->sortable(),
Tables\Columns\TextColumn::make('difference')
                ->label('Difference')
                ->getStateUsing(function ($record) {
                    return $record->respondent_count - $record->population->sample_size;
                })
                ->sortable(),


But it didn't work. So how do I access 'population.size' from the $record?

Or maybe if we can use value or $state from another column it would be better. Thanks.
Screenshot_from_2023-07-14_17-39-26.png
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

Get other column value, filament tables
FilamentFFilament / ❓┊help
3y ago
concatenate value in text column
FilamentFFilament / ❓┊help
3y ago
Default value error or problem with State
FilamentFFilament / ❓┊help
16mo ago
Toggle Column maintain state
FilamentFFilament / ❓┊help
3y ago