[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.0

Can someone vereify this code???

Asked by tmss_it_dept in Web Development, Scripting Languages, Web Development Software

Hello all.  I have 3 queries (1 main and 2 sub) that I am trying to get to work.  The issue I am having is that my array is getting pupulated with the same record multiple times (Which happens to be the last record).  I have tried almost everything, but I still can't find where my error is.  Can someone help?  Throughout the code I am doing a response.write to see the data, and it is proper, but the array isn't being pupulated correctly.  Below is the code:

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="Connections/mmm.asp" -->
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
 
 
<%
 
Dim LaborArray(50,2)  ' Array for Graph XML data.
Dim MaterialsArray(50,2)
x=0
y=0
 
Dim rsPackages
Dim rsPackages_cmd
Dim rsPackages_numRows
 
Set rsPackages_cmd = Server.CreateObject ("ADODB.Command")
rsPackages_cmd.ActiveConnection = MM_mmm_STRING
rsPackages_cmd.CommandText = "SELECT Equipment, EquipmentDesc FROM Equipment WHERE ParentId IS NULL ORDER BY Equipment ASC" 
rsPackages_cmd.Prepared = true
 
Set rsPackages = rsPackages_cmd.Execute
rsPackages_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
 
Repeat1__numRows = -1
Repeat1__index = 0
rsPackages_numRows = Recordset1_numRows + Repeat1__numRows
%>
 
<% 
	If Not rsPackages.EOF Or Not rsPackages.BOF Then 
 
	Dim strHeading
	strHeading = ""
 
	While ((Repeat1__numRows <> 0) AND (NOT rsPackages.EOF)) 
 
	If strHeading <> (rsPackages("Equipment").Value) then 
		vPackage = rsPackages("Equipment").value
	End If
%>
 
 
 
 
<% '*************************************************************************************************************************** %>
 
									<%
                                    '  ******************   Get list of ALL Labor for current package   ****************
                                    Dim vEquipment
									vEquipment = vPackage
                                    Dim rsLabor
                                    Dim rsLabor_cmd
                                    Dim rsLabor_numRows
                                    
                                    Set rsLabor_cmd = Server.CreateObject ("ADODB.Command")
                                    rsLabor_cmd.ActiveConnection = MM_mmm_STRING
                                    
                                    rsLabor_cmd.CommandText = "SELECT WOLabour.TotalCost AS SumOfTotalLabor, WorkOrder.Equipment, WOLabour.TransDate FROM WOLabour RIGHT JOIN WorkOrder ON WOLabour.WoNum = WorkOrder.WoNum WHERE (((WorkOrder.Equipment) LIKE '" & vEquipment & "%') AND ((WOLabour.TransDate) Between #1/1/2008# And #12/1/2008#)) ORDER BY WorkOrder.Equipment" 
                                    
                                    rsLabor_cmd.Prepared = true
                                    
                                    Set rsLabor = rsLabor_cmd.Execute
                                    'rsLabor_numRows = 0
                                    
									Dim Repeat2__numRows
									Dim Repeat2__index
									
									Repeat2__numRows = -1
									Repeat2__index = 0
									rsLabor_numRows = Recordset2_numRows + Repeat2__numRows
                                        
											vLaborTotal = 0
										                                          
											Dim strHeading2 ' strHeading will be populated with Craft Codes
											'strHeading = ""
											strHeading2 = vEquipment
											response.Write("strHeading2 is " & strHeading2 & "<BR>")
												
												While ((Repeat2__numRows <> 0) AND (NOT rsLabor.EOF))
													
													If strHeading2 <> vPackage Then  ' If this is a NEW Craft Code, then ...
											
														response.Write(strHeading2 & " Total = " & vLaborTotal & "<BR>") '  For Testing...
														
														x=x+1 ' Advance Array location  for Craft Codes by 1
 
														LaborArray(x,1) = strHeading2  'Add current Equipment code to Array
														LaborArray(x,2) = vLaborTotal  ' Add Labor Cost for current Craft to Array.
 
														vLaborTotal = 0 ' Reset Labor Cost back to '0' after populating array.
												
													End If
													
														vLaborTotal = round(vLaborTotal + rsLabor("SumOfTotalLabor"),2) ' Total cost for ALL labor of this Craft Code
														strHeading2 = vEquipment
														Response.Write(vLaborTotal & "<BR>") ' For testing individual totals
 
														Repeat2__index=Repeat2__index+1
														Repeat2__numRows=Repeat2__numRows-1
														
														rsLabor.MoveNext()
														
								
													Wend
										
												response.Write(strHeading2 & " Labor Total is " & vLaborTotal & "<BR>") '  For Testing...
												LaborArray(x,1) = strHeading2
												LaborArray(x,2) = vLaborTotal
												
											
                                        
                                    %>
 
<% 
 
 Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  strHeading = (rsPackages.Fields.Item("Equipment").Value)
  rsPackages.MoveNext()
Wend
%>
 
 <% End If ' end Not rsPackages.EOF Or NOT rsPackages.BOF %>
 
</head>
 
 
 
 
 
 
<body>
 
<%
' XML string for the graph.
 
xmlStr = "<chart caption='"& vTitle & "' subCaption='" & vEquip & " | "& vWeek &"' enableRotation='1' pieYScale='60' startingAngle='345' pieSliceDepth='25' formatNumberScale='0' formatNumber='1' decimals='2' forceDecimals='1' labelSepChar=' - ' showPercentageValues='1' animation='1' showLabels='1' showValues='1' >" & vbcrlf & vbcrlf
'If Not rsLabor.EOF Then
For i=0 to UBound(LaborArray)-1
xmlStr = xmlStr & "<set label='" & LaborArray(x,1) & "' value='" & LaborArray(x,2) & "' hoverText='" & LaborArray(x,2) & "' isSliced='1' />" & vbcrlf
Next
'For i=0 to UBound(MaterialsArray)-1
'xmlStr = xmlStr & "<set label='" & MaterialsArray(y,1) & "' value='" & MaterialsArray(y,2) & "' hoverText='" & MaterialsArray(y,2) & "' isSliced='1' />" & vbcrlf
'Next
'End If
'xmlStr = xmlStr & "<set label='Labor' value='"& vTotal &"' isSliced='1' />" & vbcrlf
 
xmlStr = xmlStr & "</chart>" & vbcrlf
%>
 
<p>
  <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="650" HEIGHT="400" id="FusionCharts" ALIGN="">
    <PARAM NAME=movie VALUE="Charts/Pie3d.swf?noCache=1&chartWidth=650&chartHeight=400">
    <PARAM NAME="FlashVars" VALUE="&dataXML=<%=xmlStr%>">
    <PARAM NAME=quality VALUE=high>
    <PARAM NAME=bgcolor VALUE=#FFFFFF>
    <EMBED src="Charts/Pie3d.swf" FlashVars="&dataXML=<%=xmlStr%>&chartWidth=300&chartHeight=400" quality=high bgcolor=#FFFFFF WIDTH="650" HEIGHT="400" NAME="FusionCharts" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>
  </OBJECT>
</p>
 
 
<p>
  <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="300" HEIGHT="200" ALIGN="">
    <PARAM NAME=movie VALUE="Charts/SSGrid.swf?noCache=2&chartWidth=300&chartHeight=400">
    <PARAM NAME="FlashVars" VALUE="&dataXML=<%=xmlStr%>">
    <PARAM NAME=quality VALUE=high>
    <PARAM NAME=bgcolor VALUE=#FFFFFF>
    <EMBED src="Charts/SSGrid.swf" FlashVars="&dataXML=<%=xmlStr%>&chartWidth=650&chartHeight=400" quality=high bgcolor=#FFFFFF WIDTH="300" HEIGHT="400" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>
  </OBJECT>
</p>
 
</body>
</html>
 
Related Solutions
 
Loading Advertisement...
 
[+][-]09/10/08 09:46 AM, ID: 22440283Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Web Development, Scripting Languages, Web Development Software
Sign Up Now!
Solution Provided By: tmss_it_dept
Participating Experts: 1
Solution Grade: A
 
[+][-]09/10/08 09:19 AM, ID: 22440016Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091118-EE-VQP-93 - Hierarchy / EE_QW_2_20070628