Nikki,
Here is some ABL code I use to figure the necessary Ship Date based on a customer Need By date. The "Number01" field is from the ShipTo table, which when the record is created takes the shipto State or Country and figures the standard shipping time (UPS Ground for US/Canada, whatever value our shipping guy gave me for the rest).
___
if weekday(ttorderrel.needbydate) - ShipTo.Number01 > 1 then ttOrderRel.ReqDate = ttOrderRel.NeedByDate - ShipTo.Number01.
else if weekday(ttorderrel.needbydate) - ShipTo.Number01 > -4 then ttOrderRel.ReqDate = ttOrderRel.NeedByDate - (ShipTo.Number01 + 2).
else if weekday(ttorderrel.needbydate) - ShipTo.Number01 > -9 then ttOrderRel.ReqDate = ttOrderRel.NeedByDate - (ShipTo.Number01 + 4).
else if weekday(ttorderrel.needbydate) - ShipTo.Number01 > -14 then ttOrderRel.ReqDate = ttOrderRel.NeedByDate - (ShipTo.Number01 + 6).
else if weekday(ttorderrel.needbydate) - ShipTo.Number01 > -19 then ttOrderRel.ReqDate = ttOrderRel.NeedByDate - (ShipTo.Number01 + 8).
___
The "weekday" function in ABL returns a value of 1 (Sunday) through 7 (Saturday). Crystal's "weekday" function acts the same by default, but it gives you the option to change what day the week starts on (check the Help for syntax). Excel has a similar function but I believe it returns a 0 (Sunday) through 6 (Saturday).
From there it's just math.
Good luck!
Ernie Lowell
Diba Industries
Here is some ABL code I use to figure the necessary Ship Date based on a customer Need By date. The "Number01" field is from the ShipTo table, which when the record is created takes the shipto State or Country and figures the standard shipping time (UPS Ground for US/Canada, whatever value our shipping guy gave me for the rest).
___
if weekday(ttorderrel.needbydate) - ShipTo.Number01 > 1 then ttOrderRel.ReqDate = ttOrderRel.NeedByDate - ShipTo.Number01.
else if weekday(ttorderrel.needbydate) - ShipTo.Number01 > -4 then ttOrderRel.ReqDate = ttOrderRel.NeedByDate - (ShipTo.Number01 + 2).
else if weekday(ttorderrel.needbydate) - ShipTo.Number01 > -9 then ttOrderRel.ReqDate = ttOrderRel.NeedByDate - (ShipTo.Number01 + 4).
else if weekday(ttorderrel.needbydate) - ShipTo.Number01 > -14 then ttOrderRel.ReqDate = ttOrderRel.NeedByDate - (ShipTo.Number01 + 6).
else if weekday(ttorderrel.needbydate) - ShipTo.Number01 > -19 then ttOrderRel.ReqDate = ttOrderRel.NeedByDate - (ShipTo.Number01 + 8).
___
The "weekday" function in ABL returns a value of 1 (Sunday) through 7 (Saturday). Crystal's "weekday" function acts the same by default, but it gives you the option to change what day the week starts on (check the Help for syntax). Excel has a similar function but I believe it returns a 0 (Sunday) through 6 (Saturday).
From there it's just math.
Good luck!
Ernie Lowell
Diba Industries
--- In vantage@yahoogroups.com, "nikki_vesely" <nikki.vesely@...> wrote:
>
> I would like to count the days between 2 dates with out counting Saturday or Sunday. What is the best way to do this? Does anyone already have a formula?
>