Darren Cannell Posted September 22, 2006 Posted September 22, 2006 How do I create the following: I have a start date for my students their midterm is 75 days from the startdate their final is 75 days from the midterm or 150 days from the startdate. However, summer holidays cannot be counted. Summer holiday is from June 29 until September 3rd. So, I need a script that will calculate the midterm from the startdate and the final from the startdate. This has got me stumped so any help would be appreciated. D. Cannell :P
Dali Posted September 22, 2006 Posted September 22, 2006 To calculate which date would be for example 75 days from today you can use get(currentdate) + 75 or in your case you can use start_date + 75 and for the final I'm not quite sure you got that right. I think it should be 75 days from the start date of the 2nd semester and not 75 says from midterm. What I would basically do is create two date fields in your table...call it start_date_1st and start_date_2nd then midterm date would be start_date_1st + 75 and final date would be start_date_2nd + 75....hope this helps
Darren Cannell Posted September 22, 2006 Author Posted September 22, 2006 (edited) That makes sense but in our cyber school the start dates can be any time during the school year. Some students could start in May and then span the summer...hence the need to alter the midterm and final dates. So the students have a 150 days from the day they start to complete the course material. I would like to be able to tell them what their start, midterm and final dates would be...if they span the summer I would have to not include the summer dates in the 150 days. Clear as mud right? Edited September 22, 2006 by Guest
Dali Posted September 22, 2006 Posted September 22, 2006 I see what you mean...so the only info you have on hand is their arbitrary start date, the 75 days between exams, and holiday dates...let's try this: if start_date < june_29 { // midterm if june_29 - start_date > 75 midterm = start_date + 75 //midterm falls before summer else // mid term is after summer midterm = sep_3 + 75 - (june_29 - start_date) //minus days already spent before summer //final if june 29 - start_date > 150 final = start_date + 150 else final = sep_3 + 150 - (june_29 - start_date) } else { midterm = start_date + 75; final = midterm + 75; } May not be perfect and may require some tunning, but you should be able to transfer it to filemaker if/else grammar. Make sure start_date, Sep_3 and June_29 are date fields Hope this helps
Darren Cannell Posted September 22, 2006 Author Posted September 22, 2006 Thanks for the help...I will see if I can get it into filemaker script language and then let you know if it worked. Thanks.
LaRetta Posted September 23, 2006 Posted September 23, 2006 (edited) Hi Darren, To determine the mid term, you might try calculation (date, unstored) with: startDate + 75 + If ( startDate + 75 ≥ Date ( 6 ; 29 ; Year ( Get ( CurrentDate ) ) ) and startDate ≤ Date ( 9 ; 3 ; Year ( Get ( CurrentDate ) ) ) ; 67 ) This kicks the date forward through the holiday period of 67 days. To create a final term calc, replace the 75 (in both places) with 150. This will break if the startDate is WITHIN the holiday period. Edited September 23, 2006 by Guest
Darren Cannell Posted September 25, 2006 Author Posted September 25, 2006 Thanks a pile this worked great...I appreciate the effort. The start date will never fall in the summer months...very cool.
Recommended Posts
This topic is 6633 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