Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Help Turn IfThen mess into loop!

Reply
Thread Tools

Help Turn IfThen mess into loop!

 
 
Jake
Guest
Posts: n/a
 
      01-28-2005
OK Ive got a huge amount of If Then statements that Im sure can be stripped
way down to a simple loop or two but Im not familiar enough with them to
know where to start.
Basically this is a truck scheduling application which builds a layer for
each schedule of each truck from Monday thru Sunday.
Below are the statements I have so far and I need to go up to 20 trucks. I
think you'll be able to tell what Im trying to do.
You'll notice from 3 trucks on, the layer widths are the same.

Can someone guide me on how I can convert this to a loop to cut down the
amount of code?

Thanks in advance!

<% '############## SET DIV WIDTH DETERMINED BY TRUCK COUNT
If myRS("TruckTotal") = 1 then
response.write "132"
ElseIf myRS("TruckTotal") = 2 then
response.write "67"
ElseIf myRS("TruckTotal") = 3 then
response.write "35"
ElseIf myRS("TruckTotal") > 3 then
response.write "35"
End If
%>px;
<%
'############## Grab Day, Truck # and position div horizontally
#############
'#################################### 1 Truck ###
'###Monday
If myRS("TruckTotal") = 1 then
If WeekDay(myRS2("Sched_Date"), VBMonday) = 1 then
If myRS2("TruckIndex")="1" then
response.write "left: 42px;"
end if
end if
'###Tuesday
If WeekDay(myRS2("Sched_Date"), VBMonday) = 2 then
If myRS2("TruckIndex")="1" then
response.write "left: 173px;"
end if
end if
'###Wednesday
If WeekDay(myRS2("Sched_Date"), VBMonday) = 3 then
If myRS2("TruckIndex")="1" then
response.write "left: 304px;"
end if
end if
'###Thursday
If WeekDay(myRS2("Sched_Date"), VBMonday) = 4 then
If myRS2("TruckIndex")="1" then
response.write "left: 435px;"
end if
end if
'###Friday
If WeekDay(myRS2("Sched_Date"), VBMonday) = 5 then
If myRS2("TruckIndex")="1" then
response.write "left: 566px;"
end if
end if
'###Saturday
If WeekDay(myRS2("Sched_Date"), VBMonday) = 6 then
If myRS2("TruckIndex")="1" then
response.write "left: 697px;"
end if
end if
'###Sunday
If WeekDay(myRS2("Sched_Date"), VBMonday) = 7 then
If myRS2("TruckIndex")="1" then
response.write "left: 828px;"
end if
end if
end if

'############################ 2 Trucks ###
'###Monday
If myRS("TruckTotal") = 2 then
If WeekDay(myRS2("Sched_Date"), VBMonday) = 1 then
If myRS2("TruckIndex")="1" then
response.write "left: 42px;"
elseif myRS2("TruckIndex")="2" then
response.write "left: 108px;"
end if
end if
'###Tuesday
If WeekDay(myRS2("Sched_Date"), VBMonday) = 2 then
If myRS2("TruckIndex")="1" then
response.write "left: 174px;"
elseif myRS2("TruckIndex")="2" then
response.write "left: 240px;"
end if
end if
'###Wednesday
If WeekDay(myRS2("Sched_Date"), VBMonday) = 3 then
If myRS2("TruckIndex")="1" then
response.write "left: 306px;"
elseif myRS2("TruckIndex")="2" then
response.write "left: 372px;"
end if
end if
'###Thursday
If WeekDay(myRS2("Sched_Date"), VBMonday) = 4 then
If myRS2("TruckIndex")="1" then
response.write "left: 438px;"
elseif myRS2("TruckIndex")="2" then
response.write "left: 504px;"
end if
end if
'###Friday
If WeekDay(myRS2("Sched_Date"), VBMonday) = 5 then
If myRS2("TruckIndex")="1" then
response.write "left: 570px;"
elseif myRS2("TruckIndex")="2" then
response.write "left: 636px;"
end if
end if
'###Saturday
If WeekDay(myRS2("Sched_Date"), VBMonday) = 6 then
If myRS2("TruckIndex")="1" then
response.write "left: 702px;"
elseif myRS2("TruckIndex")="2" then
response.write "left: 768px;"
end if
end if
'###Sunday
If WeekDay(myRS2("Sched_Date"), VBMonday) = 7 then
If myRS2("TruckIndex")="1" then
response.write "left: 834px;"
elseif myRS2("TruckIndex")="2" then
response.write "left: 900px;"
end if
end if
end if

'######################### 3 Trucks ###
'###Monday
If myRS("TruckTotal") = 3 then
If WeekDay(myRS2("Sched_Date"), VBMonday) = 1 then
If myRS2("TruckIndex")="1" then
response.write "left: 42px;"
elseif myRS2("TruckIndex")="2" then
response.write "left: 76px;"
elseif myRS2("TruckIndex")="3" then
response.write "left: 110px;"
end if
end if
'###Tuesday
If WeekDay(myRS2("Sched_Date"), VBMonday) = 2 then
If myRS2("TruckIndex")="1" then
response.write "left: 144px;"
elseif myRS2("TruckIndex")="2" then
response.write "left: 178px;"
elseif myRS2("TruckIndex")="3" then
response.write "left: 212px;"
end if
end if
'###Wednesday
If WeekDay(myRS2("Sched_Date"), VBMonday) = 3 then
If myRS2("TruckIndex")="1" then
response.write "left: 246px;"
elseif myRS2("TruckIndex")="2" then
response.write "left: 280px;"
elseif myRS2("TruckIndex")="3" then
response.write "left: 314px;"
end if
end if
'###Thursday
If WeekDay(myRS2("Sched_Date"), VBMonday) = 4 then
If myRS2("TruckIndex")="1" then
response.write "left: 348px;"
elseif myRS2("TruckIndex")="2" then
response.write "left:382px;"
elseif myRS2("TruckIndex")="3" then
response.write "left: 416px;"
end if
end if
'###Friday
If WeekDay(myRS2("Sched_Date"), VBMonday) = 5 then
If myRS2("TruckIndex")="1" then
response.write "left: 450px;"
elseif myRS2("TruckIndex")="2" then
response.write "left: 484px;"
elseif myRS2("TruckIndex")="3" then
response.write "left: 518px;"
end if
end if
'###Saturday
If WeekDay(myRS2("Sched_Date"), VBMonday) = 6 then
If myRS2("TruckIndex")="1" then
response.write "left: 552px;"
elseif myRS2("TruckIndex")="2" then
response.write "left: 586px;"
elseif myRS2("TruckIndex")="3" then
response.write "left: 620px;"
end if
end if
'###Sunday
If WeekDay(myRS2("Sched_Date"), VBMonday) = 7 then
If myRS2("TruckIndex")="1" then
response.write "left: 654px;"
elseif myRS2("TruckIndex")="2" then
response.write "left: 688px;"
elseif myRS2("TruckIndex")="3" then
response.write "left: 722px;"
end if
end if
end if

'######################### 4 Trucks ###
'###Monday
If myRS("TruckTotal") = 4 then
If WeekDay(myRS2("Sched_Date"), VBMonday) = 1 then
If myRS2("TruckIndex")="1" then
response.write "left: 42px;"
elseif myRS2("TruckIndex")="2" then
response.write "left: 76px;"
elseif myRS2("TruckIndex")="3" then
response.write "left: 110px;"
elseif myRS2("TruckIndex")="4" then
response.write "left: 144px;"

end if
end if
'###Tuesday
If WeekDay(myRS2("Sched_Date"), VBMonday) = 2 then
If myRS2("TruckIndex")="1" then
response.write "left: 178px;"
elseif myRS2("TruckIndex")="2" then
response.write "left: 212px;"
elseif myRS2("TruckIndex")="3" then
response.write "left: 246px;"
elseif myRS2("TruckIndex")="4" then
response.write "left: 280px;"
end if
end if
'###Wednesday
If WeekDay(myRS2("Sched_Date"), VBMonday) = 3 then
If myRS2("TruckIndex")="1" then
response.write "left: 314px;"
elseif myRS2("TruckIndex")="2" then
response.write "left: 348px;"
elseif myRS2("TruckIndex")="3" then
response.write "left: 382px;"
elseif myRS2("TruckIndex")="4" then
response.write "left: 416px;"
end if
end if
'###Thursday
If WeekDay(myRS2("Sched_Date"), VBMonday) = 4 then
If myRS2("TruckIndex")="1" then
response.write "left: 450px;"
elseif myRS2("TruckIndex")="2" then
response.write "left:484px;"
elseif myRS2("TruckIndex")="3" then
response.write "left: 518px;"
elseif myRS2("TruckIndex")="4" then
response.write "left: 552px;"
end if
end if
'###Friday
If WeekDay(myRS2("Sched_Date"), VBMonday) = 5 then
If myRS2("TruckIndex")="1" then
response.write "left: 586px;"
elseif myRS2("TruckIndex")="2" then
response.write "left: 620px;"
elseif myRS2("TruckIndex")="3" then
response.write "left: 654px;"
elseif myRS2("TruckIndex")="4" then
response.write "left: 688px;"
end if
end if
'###Saturday
If WeekDay(myRS2("Sched_Date"), VBMonday) = 6 then
If myRS2("TruckIndex")="1" then
response.write "left: 722px;"
elseif myRS2("TruckIndex")="2" then
response.write "left: 756px;"
elseif myRS2("TruckIndex")="3" then
response.write "left: 790px;"
elseif myRS2("TruckIndex")="4" then
response.write "left: 824px;"
end if
end if
'###Sunday
If WeekDay(myRS2("Sched_Date"), VBMonday) = 7 then
If myRS2("TruckIndex")="1" then
response.write "left: 858px;"
elseif myRS2("TruckIndex")="2" then
response.write "left: 892px;"
elseif myRS2("TruckIndex")="3" then
response.write "left: 926px;"
elseif myRS2("TruckIndex")="4" then
response.write "left: 960px;"
end if
end if
end if

'######################### 5 Trucks ###
'###Monday
If myRS("TruckTotal") = 5 then
If WeekDay(myRS2("Sched_Date"), VBMonday) = 1 then
If myRS2("TruckIndex")="1" then
response.write "left: 42px;"
elseif myRS2("TruckIndex")="2" then
response.write "left: 76px;"
elseif myRS2("TruckIndex")="3" then
response.write "left: 110px;"
elseif myRS2("TruckIndex")="4" then
response.write "left: 144px;"
elseif myRS2("TruckIndex")="5" then
response.write "left: 178px;"

end if
end if
'###Tuesday
If WeekDay(myRS2("Sched_Date"), VBMonday) = 2 then
If myRS2("TruckIndex")="1" then
response.write "left: 212px;"
elseif myRS2("TruckIndex")="2" then
response.write "left: 246px;"
elseif myRS2("TruckIndex")="3" then
response.write "left: 280px;"
elseif myRS2("TruckIndex")="4" then
response.write "left: 314px;"
elseif myRS2("TruckIndex")="5" then
response.write "left: 348px;"
end if
end if
'###Wednesday
If WeekDay(myRS2("Sched_Date"), VBMonday) = 3 then
If myRS2("TruckIndex")="1" then
response.write "left: 382px;"
elseif myRS2("TruckIndex")="2" then
response.write "left: 416px;"
elseif myRS2("TruckIndex")="3" then
response.write "left: 450px;"
elseif myRS2("TruckIndex")="4" then
response.write "left: 484px;"
elseif myRS2("TruckIndex")="5" then
response.write "left: 518px;"
end if
end if
'###Thursday
If WeekDay(myRS2("Sched_Date"), VBMonday) = 4 then
If myRS2("TruckIndex")="1" then
response.write "left: 552px;"
elseif myRS2("TruckIndex")="2" then
response.write "left:586px;"
elseif myRS2("TruckIndex")="3" then
response.write "left:6208px;"
elseif myRS2("TruckIndex")="4" then
response.write "left: 654px;"
elseif myRS2("TruckIndex")="5" then
response.write "left: 688px;"
end if
end if
'###Friday
If WeekDay(myRS2("Sched_Date"), VBMonday) = 5 then
If myRS2("TruckIndex")="1" then
response.write "left: 722px;"
elseif myRS2("TruckIndex")="2" then
response.write "left: 756px;"
elseif myRS2("TruckIndex")="3" then
response.write "left: 790px;"
elseif myRS2("TruckIndex")="4" then
response.write "left: 824px;"
elseif myRS2("TruckIndex")="5" then
response.write "left: 858px;"
end if
end if
'###Saturday
If WeekDay(myRS2("Sched_Date"), VBMonday) = 6 then
If myRS2("TruckIndex")="1" then
response.write "left: 892px;"
elseif myRS2("TruckIndex")="2" then
response.write "left: 926px;"
elseif myRS2("TruckIndex")="3" then
response.write "left: 960px;"
elseif myRS2("TruckIndex")="4" then
response.write "left: 994px;"
elseif myRS2("TruckIndex")="5" then
response.write "left: 1028px;"
end if
end if
'###Sunday
If WeekDay(myRS2("Sched_Date"), VBMonday) = 7 then
If myRS2("TruckIndex")="1" then
response.write "left: 1062px;"
elseif myRS2("TruckIndex")="2" then
response.write "left: 1096px;"
elseif myRS2("TruckIndex")="3" then
response.write "left: 1130px;"
elseif myRS2("TruckIndex")="4" then
response.write "left: 1164px;"
elseif myRS2("TruckIndex")="5" then
response.write "left: 1198px;"
end if
end if
end if
'######## AND SO ON TILL 20 TRUCKS REACHED


 
Reply With Quote
 
 
 
 
McKirahan
Guest
Posts: n/a
 
      01-28-2005
"Jake" <(E-Mail Removed)> wrote in message
news:#MZ$(E-Mail Removed)...
> OK Ive got a huge amount of If Then statements that Im sure can be

stripped
> way down to a simple loop or two but Im not familiar enough with them to
> know where to start.
> Basically this is a truck scheduling application which builds a layer for
> each schedule of each truck from Monday thru Sunday.
> Below are the statements I have so far and I need to go up to 20 trucks. I
> think you'll be able to tell what Im trying to do.
> You'll notice from 3 trucks on, the layer widths are the same.
>
> Can someone guide me on how I can convert this to a loop to cut down the
> amount of code?
>
> Thanks in advance!
>
> <% '############## SET DIV WIDTH DETERMINED BY TRUCK COUNT
> If myRS("TruckTotal") = 1 then
> response.write "132"
> ElseIf myRS("TruckTotal") = 2 then
> response.write "67"
> ElseIf myRS("TruckTotal") = 3 then
> response.write "35"
> ElseIf myRS("TruckTotal") > 3 then
> response.write "35"
> End If
> %>px;
> <%
> '############## Grab Day, Truck # and position div horizontally
> #############
> '#################################### 1 Truck ###
> '###Monday
> If myRS("TruckTotal") = 1 then
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 1 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 42px;"
> end if
> end if
> '###Tuesday
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 2 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 173px;"
> end if
> end if
> '###Wednesday
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 3 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 304px;"
> end if
> end if
> '###Thursday
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 4 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 435px;"
> end if
> end if
> '###Friday
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 5 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 566px;"
> end if
> end if
> '###Saturday
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 6 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 697px;"
> end if
> end if
> '###Sunday
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 7 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 828px;"
> end if
> end if
> end if
>
> '############################ 2 Trucks ###
> '###Monday
> If myRS("TruckTotal") = 2 then
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 1 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 42px;"
> elseif myRS2("TruckIndex")="2" then
> response.write "left: 108px;"
> end if
> end if
> '###Tuesday
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 2 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 174px;"
> elseif myRS2("TruckIndex")="2" then
> response.write "left: 240px;"
> end if
> end if
> '###Wednesday
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 3 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 306px;"
> elseif myRS2("TruckIndex")="2" then
> response.write "left: 372px;"
> end if
> end if
> '###Thursday
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 4 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 438px;"
> elseif myRS2("TruckIndex")="2" then
> response.write "left: 504px;"
> end if
> end if
> '###Friday
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 5 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 570px;"
> elseif myRS2("TruckIndex")="2" then
> response.write "left: 636px;"
> end if
> end if
> '###Saturday
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 6 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 702px;"
> elseif myRS2("TruckIndex")="2" then
> response.write "left: 768px;"
> end if
> end if
> '###Sunday
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 7 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 834px;"
> elseif myRS2("TruckIndex")="2" then
> response.write "left: 900px;"
> end if
> end if
> end if
>
> '######################### 3 Trucks ###
> '###Monday
> If myRS("TruckTotal") = 3 then
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 1 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 42px;"
> elseif myRS2("TruckIndex")="2" then
> response.write "left: 76px;"
> elseif myRS2("TruckIndex")="3" then
> response.write "left: 110px;"
> end if
> end if
> '###Tuesday
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 2 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 144px;"
> elseif myRS2("TruckIndex")="2" then
> response.write "left: 178px;"
> elseif myRS2("TruckIndex")="3" then
> response.write "left: 212px;"
> end if
> end if
> '###Wednesday
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 3 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 246px;"
> elseif myRS2("TruckIndex")="2" then
> response.write "left: 280px;"
> elseif myRS2("TruckIndex")="3" then
> response.write "left: 314px;"
> end if
> end if
> '###Thursday
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 4 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 348px;"
> elseif myRS2("TruckIndex")="2" then
> response.write "left:382px;"
> elseif myRS2("TruckIndex")="3" then
> response.write "left: 416px;"
> end if
> end if
> '###Friday
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 5 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 450px;"
> elseif myRS2("TruckIndex")="2" then
> response.write "left: 484px;"
> elseif myRS2("TruckIndex")="3" then
> response.write "left: 518px;"
> end if
> end if
> '###Saturday
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 6 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 552px;"
> elseif myRS2("TruckIndex")="2" then
> response.write "left: 586px;"
> elseif myRS2("TruckIndex")="3" then
> response.write "left: 620px;"
> end if
> end if
> '###Sunday
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 7 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 654px;"
> elseif myRS2("TruckIndex")="2" then
> response.write "left: 688px;"
> elseif myRS2("TruckIndex")="3" then
> response.write "left: 722px;"
> end if
> end if
> end if
>
> '######################### 4 Trucks ###
> '###Monday
> If myRS("TruckTotal") = 4 then
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 1 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 42px;"
> elseif myRS2("TruckIndex")="2" then
> response.write "left: 76px;"
> elseif myRS2("TruckIndex")="3" then
> response.write "left: 110px;"
> elseif myRS2("TruckIndex")="4" then
> response.write "left: 144px;"
>
> end if
> end if
> '###Tuesday
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 2 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 178px;"
> elseif myRS2("TruckIndex")="2" then
> response.write "left: 212px;"
> elseif myRS2("TruckIndex")="3" then
> response.write "left: 246px;"
> elseif myRS2("TruckIndex")="4" then
> response.write "left: 280px;"
> end if
> end if
> '###Wednesday
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 3 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 314px;"
> elseif myRS2("TruckIndex")="2" then
> response.write "left: 348px;"
> elseif myRS2("TruckIndex")="3" then
> response.write "left: 382px;"
> elseif myRS2("TruckIndex")="4" then
> response.write "left: 416px;"
> end if
> end if
> '###Thursday
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 4 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 450px;"
> elseif myRS2("TruckIndex")="2" then
> response.write "left:484px;"
> elseif myRS2("TruckIndex")="3" then
> response.write "left: 518px;"
> elseif myRS2("TruckIndex")="4" then
> response.write "left: 552px;"
> end if
> end if
> '###Friday
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 5 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 586px;"
> elseif myRS2("TruckIndex")="2" then
> response.write "left: 620px;"
> elseif myRS2("TruckIndex")="3" then
> response.write "left: 654px;"
> elseif myRS2("TruckIndex")="4" then
> response.write "left: 688px;"
> end if
> end if
> '###Saturday
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 6 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 722px;"
> elseif myRS2("TruckIndex")="2" then
> response.write "left: 756px;"
> elseif myRS2("TruckIndex")="3" then
> response.write "left: 790px;"
> elseif myRS2("TruckIndex")="4" then
> response.write "left: 824px;"
> end if
> end if
> '###Sunday
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 7 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 858px;"
> elseif myRS2("TruckIndex")="2" then
> response.write "left: 892px;"
> elseif myRS2("TruckIndex")="3" then
> response.write "left: 926px;"
> elseif myRS2("TruckIndex")="4" then
> response.write "left: 960px;"
> end if
> end if
> end if
>
> '######################### 5 Trucks ###
> '###Monday
> If myRS("TruckTotal") = 5 then
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 1 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 42px;"
> elseif myRS2("TruckIndex")="2" then
> response.write "left: 76px;"
> elseif myRS2("TruckIndex")="3" then
> response.write "left: 110px;"
> elseif myRS2("TruckIndex")="4" then
> response.write "left: 144px;"
> elseif myRS2("TruckIndex")="5" then
> response.write "left: 178px;"
>
> end if
> end if
> '###Tuesday
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 2 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 212px;"
> elseif myRS2("TruckIndex")="2" then
> response.write "left: 246px;"
> elseif myRS2("TruckIndex")="3" then
> response.write "left: 280px;"
> elseif myRS2("TruckIndex")="4" then
> response.write "left: 314px;"
> elseif myRS2("TruckIndex")="5" then
> response.write "left: 348px;"
> end if
> end if
> '###Wednesday
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 3 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 382px;"
> elseif myRS2("TruckIndex")="2" then
> response.write "left: 416px;"
> elseif myRS2("TruckIndex")="3" then
> response.write "left: 450px;"
> elseif myRS2("TruckIndex")="4" then
> response.write "left: 484px;"
> elseif myRS2("TruckIndex")="5" then
> response.write "left: 518px;"
> end if
> end if
> '###Thursday
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 4 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 552px;"
> elseif myRS2("TruckIndex")="2" then
> response.write "left:586px;"
> elseif myRS2("TruckIndex")="3" then
> response.write "left:6208px;"
> elseif myRS2("TruckIndex")="4" then
> response.write "left: 654px;"
> elseif myRS2("TruckIndex")="5" then
> response.write "left: 688px;"
> end if
> end if
> '###Friday
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 5 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 722px;"
> elseif myRS2("TruckIndex")="2" then
> response.write "left: 756px;"
> elseif myRS2("TruckIndex")="3" then
> response.write "left: 790px;"
> elseif myRS2("TruckIndex")="4" then
> response.write "left: 824px;"
> elseif myRS2("TruckIndex")="5" then
> response.write "left: 858px;"
> end if
> end if
> '###Saturday
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 6 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 892px;"
> elseif myRS2("TruckIndex")="2" then
> response.write "left: 926px;"
> elseif myRS2("TruckIndex")="3" then
> response.write "left: 960px;"
> elseif myRS2("TruckIndex")="4" then
> response.write "left: 994px;"
> elseif myRS2("TruckIndex")="5" then
> response.write "left: 1028px;"
> end if
> end if
> '###Sunday
> If WeekDay(myRS2("Sched_Date"), VBMonday) = 7 then
> If myRS2("TruckIndex")="1" then
> response.write "left: 1062px;"
> elseif myRS2("TruckIndex")="2" then
> response.write "left: 1096px;"
> elseif myRS2("TruckIndex")="3" then
> response.write "left: 1130px;"
> elseif myRS2("TruckIndex")="4" then
> response.write "left: 1164px;"
> elseif myRS2("TruckIndex")="5" then
> response.write "left: 1198px;"
> end if
> end if
> end if
> '######## AND SO ON TILL 20 TRUCKS REACHED
>
>


Can you boil it down to a matrix (spreadsheet)?

Perhaps by "TruckTotal" and "TruckIndex"; for example,

1.1 = 42,173,304,435,566,697,828

2.1 = 42,174,306,438,570,702,834
2.2 = 108,240,372,504,636,768,900

etc.

(It would be nice if 1.1 = 2.1 etc.)


Also, "left:6208px;" should probably be "left:620px;"


 
Reply With Quote
 
 
 
 
larrybud2002@yahoo.com
Guest
Posts: n/a
 
      01-28-2005

Jake wrote:
> OK Ive got a huge amount of If Then statements that Im sure can be

stripped
> way down to a simple loop or two but Im not familiar enough with them

to
> know where to start.
> Basically this is a truck scheduling application which builds a layer

for
> each schedule of each truck from Monday thru Sunday.
> Below are the statements I have so far and I need to go up to 20

trucks. I
> think you'll be able to tell what Im trying to do.
> You'll notice from 3 trucks on, the layer widths are the same.


I would put all of this data into a database and check it against that.
Have a range of values in the database for TruckTotal, and you'd have
divwidth, etc.

Then do a select based on your input parameters.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET, VS.NET, shared controls, and ORM classes: how can I organize my mess into neat projects? ASP .Net 0 02-21-2007 08:30 PM
PIX 515, DMZ, VPN, what a mess. Need Help. Eddie Cisco 9 06-20-2004 08:22 PM
turn quotes into &quot; and apostrophes into &apos; Eric Osman Javascript 2 04-14-2004 03:51 PM
Need help with switch() mess Christopher Benson-Manica C++ 11 02-06-2004 04:35 PM
need help not receiving any mess. lsmfav Computer Support 1 10-17-2003 02:51 PM



Advertisments