+ Start a Discussion
Vigneshwaran LoganathanVigneshwaran Loganathan 

Need to get Overlapping dates

Hi frnz, I need a logic for below situation in TRIGGER.

** VA is a parent object which has Cancellation as Child that has three records with 'start date' and 'end date' fields.
We need to calculate total days between Start date and End date in three records, then store it in VA.

** Now if those three records have any Overlapping days, we should not count that. For Example.......

Record1 - start date = jul 01 2015, end date = Jul 31 2015  = 31 days
Record2 - start date = Jul 10 2015, end date = Jul 20 2015  = 0 Dates were overlapped by the others
Record3 - start date = Jun 21 2014, end date = Jul 05 2015 = 10 days (Jun 21 - Jun 30, july 01 - july 05 overlapped by the others)
Record4 - start date = Jun 01 2014, end date = Jun 05 2014 = 5 days
total of 46 days

How to achieve this?
Thanks. :))
 
Ravi Gupta 15Ravi Gupta 15
Just google it... ;)
Vigneshwaran LoganathanVigneshwaran Loganathan
Not for kiddos buddy :) Anyways, I dint get any from google, that why asked here.

Thanks.