I'm building a DBF -based app for a high school sports team that handles "snack pledges" for a given race (families bring snacks to races for the team)
I have two tables:
RACE_SNACKS and SNACK_PLEDGES
RACE_SNACKS is an "inventory" of snacks needed while SNACK_PLEDGES is used by the families to enter what snacks and how many they are bringing
When someone enters a snack pledge, they need to know how many of a given snack have already been pledged by someone else and how many are still needed.
My question, finally, is: How can I create a calculated field (in DBF or web grid) that calculates how many snacks have already been pledged? If I were to write an SQL statement, I could easily do it something like this: SELECT SUM(SnackPledgeQuantity) AS ALREADY_PLEDGED FROM SNACK_PLEDGES WHERE SnackPledgeID = (ID of the currently selected record on the grid) However, I don't suppose I can run this type of SQL select statement within A5, so it would have to be some kind of xBasic TOTAL() function, I suppose. This function should run whenever a grid is refreshed (displayed initially or refreshed when going to another grid page) and whenever the SnackPledgeQuantity is changed in the current record on the grid.
I have no idea how to write one, where to insert it, etc. A5 documentation is not much help here, either.
I would appreciate any help anyone can give me. Eventually I hope to start giving back, but being an A5 newbie I don't know enough to even be dangerous yet.
I have two tables:
RACE_SNACKS and SNACK_PLEDGES
RACE_SNACKS is an "inventory" of snacks needed while SNACK_PLEDGES is used by the families to enter what snacks and how many they are bringing
When someone enters a snack pledge, they need to know how many of a given snack have already been pledged by someone else and how many are still needed.
My question, finally, is: How can I create a calculated field (in DBF or web grid) that calculates how many snacks have already been pledged? If I were to write an SQL statement, I could easily do it something like this: SELECT SUM(SnackPledgeQuantity) AS ALREADY_PLEDGED FROM SNACK_PLEDGES WHERE SnackPledgeID = (ID of the currently selected record on the grid) However, I don't suppose I can run this type of SQL select statement within A5, so it would have to be some kind of xBasic TOTAL() function, I suppose. This function should run whenever a grid is refreshed (displayed initially or refreshed when going to another grid page) and whenever the SnackPledgeQuantity is changed in the current record on the grid.
I have no idea how to write one, where to insert it, etc. A5 documentation is not much help here, either.
I would appreciate any help anyone can give me. Eventually I hope to start giving back, but being an A5 newbie I don't know enough to even be dangerous yet.
Comment