How to compare two fields value of different tables in Relation Manager?
HI! I'm trying to compare two values, using "Relation Manager", unfortunately without success.
The fields I'm trying to compare are in two different tables, related to each other.
I would like to be able to compare the "estimate_at_completion" field which is present in the table "EarnedValue" with the "budget_to_complete" field which is present in the table "wbe".
i cant get the value of "wbe.budget_to_complete"
Tables\Columns\TextColumn::make('estimate_at_completion')
->label('EAC')
->badge()
->color(fn ($state): string => floatval($state) < floatval('wbe.budget_to_complete') ? 'success' : 'danger')
Solution:Jump to solution
Does the
$record
var let you dig into those properties? (ie: fn ($state, $record)
)3 Replies
Solution
Does the
$record
var let you dig into those properties? (ie: fn ($state, $record)
)It was recommended to me on GitHub to use $record->wbe->budget_to_complete and this worked. So, also your answer is correct! Thank You!
Here is the code:
Tables\Columns\TextColumn::make('estimate_at_completion')
->label('EAC')
->badge()
->color(fn ($state, $record): string => floatval($state) < floatval($record->wbe->budget_to_complete) ? 'success' : 'danger'),