Chemadian Posted June 1, 2012 Posted June 1, 2012 Hey Everyone, I'm looking for a little help building a calculation to create a recurrent event based on the contents of a specific field. Basically what i've done is integrate a simple calendar solution into a database that tracks deliveries to my various customers. I've gotten to where my related delivery information is displayed in the calendar layout but i am looking for a way to set recurrent deliveries based on a Delivery::DeliverySchedule field. The values of this field can either be "weekly", "2 Weeks" or "4 weeks". So for example if i have a delivery set for today, friday june 1st, and the delivery schedule field is set to "weekly" i want another delivery for this customer automatically set to next friday (june 8th). I'm sure there is a calculation to accomplish this but so far my feable attempts have been in vain! Any help would be greatly appreciated!! cheers
eos Posted June 1, 2012 Posted June 1, 2012 Try this one. Not exhaustively tested. Uses Get ( CurrentDate ) as the base date, and creates delivery dates for a period of base date + 90 days. Adjust to your own fields and business rules. Also, you'd need a similar script which checks on startup if new dates are due for creation. RecurringEvents_eos.fp7.zip
Chemadian Posted June 7, 2012 Author Posted June 7, 2012 Hey eos, Thanks for the demo file. Unfortunately when i tried to adjust and implement the script you designed something went wonky. The calendar solution i mentioned in my first post is based on 7 filtered portals, one for each day of the week. I of course didn't come up with the calendar i just stumbled upon the file while i was searching for calendar solutions on google. i've attached the file i found so maybe it will help clarify what i'm looking to do. As for the changes i made to the script, basically i didn't incorporate your DeliveryDates table, instead i just tried substituting in the "weeks" table for which the calendar layout is built. I made other changes but they were mostly just to accomodate my specific tables and fields. Thanks again for the help! Calendar Demo.fp7.zip
eos Posted June 7, 2012 Posted June 7, 2012 I don't see the problem. The Weeks table is used to structure the display, but what is displayed there is based on entries in an Events table. If you use my script logic to create delivery dates in Events, they should show up there as well.
comment Posted June 7, 2012 Posted June 7, 2012 for example if i have a delivery set for today, friday june 1st, and the delivery schedule field is set to "weekly" i want another delivery for this customer automatically set to next friday (june 8th). Here's the thing: it's not too difficult to calculate the delivery date (or dates) of each "event" for the currently viewed month (or any other period). However, since the currently viewed month is set arbitrarily by the user, the calculation must be unstored - and therefore cannot be used as the matchfield in a relationship. If you don't want to set up a "until date" for each event (and thus limit the number of occurrences that can be calculated), then your best bet would be to use filtered portal/s to show the deliveries that fall within the selected view period.
Chemadian Posted June 12, 2012 Author Posted June 12, 2012 Thanks for the replies. I think i am getting hung up on the fact that i don't want a new record created for each subsequent date, rather i have one record that i want displayed on multiple dates depending on information contained in the fields for that record. I know this probably seems like a bad setup, but basically this calendar is just used for scheduling purposes, not an actual delivery that is being fulfilled. So if i have one record for a customer that is set for today, tuesday june 12th, and another field in that record that is set for 2 weeks is there a way to have a couple other fields (such as the customers name) from this record get displayed on the calendar every second tuesday? Thanks again for your help!
eos Posted June 16, 2012 Posted June 16, 2012 You can't use the calendar solution from your example file with date lists in your Customer table. Check the relationships from Events to Weeks in the calendar display, and you'll see why. I really suggest using the "create one record per scheduled date" approach; you already have the system in place. You only need to store the CustomerID with the Event record and add a Customer TO “behind” Events, and you "have one record that i want displayed on multiple dates depending on information contained in the fields for that record" - namely, the Customer record itself, which shows up in an event courtesy of related fields.
Recommended Posts
This topic is 4600 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