This topic is 6143 days old. Please don't post here. Open a new topic instead.

## Recommended Posts

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?

##### Share on other sites

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.

##### Share on other sites

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.

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......

##### Share on other sites

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 )

)

##### Share on other sites

Thanks that did it.

I added a Case statement to take care of the Sat. and Sun. thing.

Again thanks....

##### Share on other sites

This topic is 6143 days old. Please don't post here. Open a new topic instead.

## Create an account

Register a new account