Solved
Perform Queries on Calculated fields within OnCalcFields Event
Posted on 2004-04-26
Is it possible to Perform Queries on Calculated fields within OnCalcFields Event? If so, how would I go about doing it?
Example:
Consider the following:
Teams
- id
- Team
- Points - Calculated field (calculated from sql on Players Table)
Players
- id
- TeamId
- Player
- Points - Calculated field (calculated from sql on Matches Table)
Matches
- id
- Date
- Team1 - Lookup from Teams
- T1Points - Calculated field (calculated from sql on Games Table)
- Team2 - Lookup from Teams
- T2Points - Calculated field (calculated from sql on Games Table)
Games
- Id
- MatchId
- MatchType - {Singles, Doubles}
- T1Player1 - Team 1 Player 1 - A Lookup from Players
- T1Points1
- T1Player2 - Team 1 Player 2 - A Lookup from Players
- T1Points2
- T2Player1 - Team 2 Player 1 - A Lookup from Players
- T2Points1
- T2Player2 - Team 2 Player 2 - A Lookup from Players
- T2Points2
The Games table will be the only point aby which points will be entered.
The Matche's table calculated field (T1Points * T2Points) should be calculated from the total points of T1Points1 & T1Points2 from the Games table.
(e.g. for all those records with matchId)
and
The Player's Table calculated field (points) should be calculated from the Games table all matching records of Player.
and
The Team's Table calculated field (points) should be calculated from the Matches table all matching records of Teams
.
What would the queries look like? How would I write the OnCalcField Events?
Shane