Salesman0Gil Posted November 28, 2006 Share Posted November 28, 2006 I have a transportations system that is broken in two parts. One picks up every Mon, Wed, and Fri, and the Other picks up every Tues, Thur, Sun Using today's date how can I define a field to tell me what day something will be picked up? Link to comment Share on other sites More sharing options...

comment Posted November 28, 2006 Share Posted November 28, 2006 I don't think you have given us enough information. Link to comment Share on other sites More sharing options...

Salesman0Gil Posted November 28, 2006 Author Share Posted November 28, 2006 OK Here is what I've come up with so far: If ((even odd = 2) and DayOfWeek ( If(DayOfWeek(test date 7 +( If ((If (Mod(DayOfWeek (test date 7 );2)=0 and Mod(even odd;2) = 0;1 ;If (Mod(DayOfWeek (test date 7 );2) ≠ 0 and Mod(even odd;2) ≠ 0;1 ;0 )))=1;0;1)))=7;(test date 7 +( If ((If (Mod(DayOfWeek (test date 7 );2)=0 and Mod(even odd;2) = 0;1 ;If (Mod(DayOfWeek (test date 7 );2) ≠ 0 and Mod(even odd;2) ≠ 0;1 ;0 )))=1;0;1)))+1;test date 7 +( If ((If (Mod(DayOfWeek (test date 7 );2)=0 and Mod(even odd;2) = 0;1 ;If (Mod(DayOfWeek (test date 7 );2) ≠ 0 and Mod(even odd;2) ≠ 0;1 ;0 )))=1;0;1))) =1); If(DayOfWeek(test date 7 +( If ((If (Mod(DayOfWeek (test date 7 );2)=0 and Mod(even odd;2) = 0;1 ;If (Mod(DayOfWeek (test date 7 );2) ≠ 0 and Mod(even odd;2) ≠ 0;1 ;0 )))=1;0;1)))=7;(test date 7 +( If ((If (Mod(DayOfWeek (test date 7 );2)=0 and Mod(even odd;2) = 0;1 ;If (Mod(DayOfWeek (test date 7 );2) ≠ 0 and Mod(even odd;2) ≠ 0;1 ;0 )))=1;0;1)))+1;test date 7 +( If ((If (Mod(DayOfWeek (test date 7 );2)=0 and Mod(even odd;2) = 0;1 ;If (Mod(DayOfWeek (test date 7 );2) ≠ 0 and Mod(even odd;2) ≠ 0;1 ;0 )))=1;0;1)))+3; If(DayOfWeek(test date 7 +( If ((If (Mod(DayOfWeek (test date 7 );2)=0 and Mod(even odd;2) = 0;1 ;If (Mod(DayOfWeek (test date 7 );2) ≠ 0 and Mod(even odd;2) ≠ 0;1 ;0 )))=1;0;1)))=7;(test date 7 +( If ((If (Mod(DayOfWeek (test date 7 );2)=0 and Mod(even odd;2) = 0;1 ;If (Mod(DayOfWeek (test date 7 );2) ≠ 0 and Mod(even odd;2) ≠ 0;1 ;0 )))=1;0;1)))+1;test date 7 +( If ((If (Mod(DayOfWeek (test date 7 );2)=0 and Mod(even odd;2) = 0;1 ;If (Mod(DayOfWeek (test date 7 );2) ≠ 0 and Mod(even odd;2) ≠ 0;1 ;0 )))=1;0;1)))) "test date 7" = is a testing field. In the file I have currently there are 7 "test Field" and test day 1 is equal to 12/3/2006, and test day 2 equal to 12/4/2006, etc. I have found that this calc works, but not consistently. I will try and attach the file. Link to comment Share on other sites More sharing options...

Salesman0Gil Posted November 28, 2006 Author Share Posted November 28, 2006 Also "Even Odd" is either a 1 or a 2. 1 if the run is on Sunday, Tuesday, Thurs. 2 if the run is Mon., Wed., Fri. comment, as far as more information.... lets simplify this. There are two trucks. Truck 1 picks up on Mon, Wed, Fri Truck 2 picks up on Sun, Tues, Thur. Notice no Sat.. If I put something out for a truck1 today(Tues) when it it get picked up, not until Wednesday, but if it was going to go on truck 2 it would get picked up today. So with a combination of today's date and what truck it is on, I should be able to tell when the truck will pick it up. Sorry if I made it more confusing, I've been starring at the define calc field box for far too long...... Link to comment Share on other sites More sharing options...

comment Posted November 28, 2006 Share Posted November 28, 2006 If I understand this correctly, the day of week can be either odd or even, and so can the truck number. If the two parities are the same, there's no delay. If they are not the same, there's a delay of one day (or the other way around, if you've numbered the trucks differently). If so, you should be able to get the pick up date by something like: Let ( [ dayParity = Mod ( DayOfWeek ( Date ) ; 2 ) ; truckParity = Mod ( TruckNumber ; 2 ) ] ; Date + ( dayParity xor truckParity ) ) Link to comment Share on other sites More sharing options...

Salesman0Gil Posted November 29, 2006 Author Share Posted November 29, 2006 Thanks that did it. I added a Case statement to take care of the Sat. and Sun. thing. Again thanks.... Link to comment Share on other sites More sharing options...

## Recommended Posts

This topic is

6143 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 account## Sign in

Already have an account? Sign in here.

Sign In Now