Reid Posted August 21, 2010 Posted August 21, 2010 I have a mileage field that calculates how much a person is paid for mileage each day. When they put in one of their appointments it automatically fills in this field based on how much they receive which is found in the employee table. The problem is that at this point it calculates every time they put in an appointment but they only get paid for it once per day. How can I have it check to see if it has already been entered for that date and then leave it blank if one already exists? Thanks!
Reid Posted August 22, 2010 Author Posted August 22, 2010 I'm trying to figure out how this works so I can apply it to my database. Why does the EmpID and Date have to have a relationship when they are part of the same table? Can you explain what each part of the formula does? Case ( LogID = SameDateEntries::LogID ; PerDiem )
comment Posted August 22, 2010 Posted August 22, 2010 Each record is related to its "siblings" (same employee and same date), including itself. The calculation asks: am I the first record in the siblings group? If yes, return the per diem value. The first related record is determined by the sort order of the relationship (in this example the default creation order) and is the same for all records in the group. Therefore only one record in each group will get a positive answer to the question.
Reid Posted August 26, 2010 Author Posted August 26, 2010 Your formula is Case ( LogID = SameDateEntries::LogID ; PerDiem ) What if I don't have a LogID field? I probably should have one but is there a way around this? If not, how can I create a serial number auto field and have it add to all the records I already have?
Reid Posted August 26, 2010 Author Posted August 26, 2010 Also, my "PerDiem" comes from a different table. Do I have to make another relationship then? Sorry for the trouble...this is just a bit confusing to me.
comment Posted August 26, 2010 Posted August 26, 2010 What if I don't have a LogID field? If you don't have a field that uniquely identifies a record, then this won't work for you. You can solve this by defining a field that auto-enters a serial number. Put the field on the layout, show all records, click in the field and populate it by choosing Records > Replace Field Contents… > Replace with serial numbers (Update...). After that, remove the field from the layout, or make it non-enterable, or not modifiable. Also, my "PerDiem" comes from a different table. It doesn't really matter where it comes from. This would work even if the value were related. Hopefully, you are looking it up and storing it in the appointment record - otherwise you'll be in trouble when the amount is updated.
Recommended Posts
This topic is 5261 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now