I need to allow users to create repeating trips in our system (referred to as Calendar Trips). So when a trip record is created users can click on a button that opens up a dialog and displays checkboxes for the all 7 days of the week. So if the user checks Monday, Wednesday and Friday, for example, and saves the record, I need the system to automatically create duplicate records based on the info on this trip record for every Monday, Wednesday and Friday for the foreseeable future.
1. I understand how to use DayOfWeek (date) function to get the day of the week for a given date, but I am not sure how to do the reverse, i.e. find the date for next Monday, etc. What would be the best approach to this?
2. I also don't think that I want 1000's of these records created automatically, so I think a) I will add a field where the user can enter an end date for these auto creations, or b) better yet have these auto created may be every Monday at 12 AM for the following week? I just need a way to not create 1000's of records at once.
Any suggestions would be appreciated.