Logic problems

1. Join Date
Dec 1969
Posts
48

## Logic problems

can someone help me sort out this statement to get the syntax correct:<BR><BR>FOR P = LBound(comboArray, 2) To UBound(comboArray, 2)<BR> IF <BR> comboArray(0,P) = countarray( 0, LBound(countArray, 2) To UBound(countArray, 2) )<BR> THEN<BR> comboArray(4,P) = countarray( 1, LBound(countArray, 2) To UBound(countArray, 2) )<BR> END IF<BR>NEXT

2. Senior Member
Join Date
Dec 1969
Posts
11,334

## What are you trying to do?

Code is very confusing... I think you want something like<BR><BR>for p = 0 to UBound(comboArray,2) &#039;no need for LBound<BR> if comboArray(0,p) = something Then<BR> &#039;do this<BR> end if<BR>next

3. Senior Member
Join Date
Dec 1969
Posts
11,334

## sdrawkcab

if comboArray(p,0) = something Then

4. Join Date
Dec 1969
Posts
48

## combining information

I have two arrays: comboArray and countArray. What I&#039;m trying to do is compare the first fields in each array and if they are eqaul I want to fill the last field of the comboArray with the data from the second field of the countArray.

5. Join Date
Dec 1969
Posts
48

## This may help..

Here is some more code:<BR><BR>set rstGetRows = Server.CreateObject("ADODB.Recordset")<BR> strCon = ""<BR> strSQL = "SELECT ID, MenuText, ParentID, SortOrder FROM tblMenus WHERE SiteID=20 ORDER BY ParentID, SortOrder;" <BR> rstGetRows.open strSQL, strCon<BR> mapArray = rstGetRows.getRows() <BR> rstGetRows.close<BR><BR> strSQL = "SELECT Max(ParentID) AS firstChild, COUNT(ParentID) AS childCount FROM tblMenus WHERE siteID=20 GROUP BY <BR><BR>ParentId;"<BR><BR> rstGetRows.open strSQL, strCon<BR> countArray = rstGetRows.getRows()<BR> rstGetRows.close<BR> Set rstGetRows = Nothing<BR><BR> iRecFirst = LBound(mapArray, 2)<BR> iRecLast = UBound(mapArray, 2)<BR> iFieldFirst = LBound(mapArray, 1)<BR> iFieldLast = UBound(mapArray, 1)<BR> iRecFirstb = LBound(countArray, 2)<BR> iRecLastb = UBound(countArray, 2)<BR> iFieldFirstb = LBound(countArray, 1)<BR> iFieldLastb = UBound(countArray, 1)<BR><BR><BR> Redim comboArray(5,iRecLast)<BR> for i = iRecFirst To iRecLast<BR> comboArray(0,i) = mapArray(0,i)<BR> comboArray(1,i) = mapArray(1,i)<BR> comboArray(2,i) = mapArray(2,i)<BR> comboArray(3,i) = mapArray(3,i)<BR> comboArray(4,i) = 0<BR> next<BR><BR>FOR P = 0 To UBound(comboArray, 2)<BR> IF <BR> comboArray(0,P) = countarray( 0, LBound(countArray, 2) To UBound(countArray, 2) )<BR> THEN<BR> comboArray(4,P) = countarray( 1, LBound(countArray, 2) To UBound(countArray, 2) )<BR> END IF<BR>NEXT<BR><BR><BR>&#039;This line calls the function<BR>array_dump()<BR><BR>&#039;This is the function declaration<BR>function array_dump()<BR><BR><BR><BR> response.write "&#060;table border=1&#062;"<BR> for i = iRecFirst To iRecLast<BR> response.write "&#060;tr&#062;"<BR> for j = iFieldFirst to iFieldLast + 1<BR> response.write "&#060;td&#062;" & comboArray(j,i) & "&#060;/td&#062;"<BR> next<BR> response.write "&#060;/tr&#062;"<BR> next<BR> response.write "&#060;/table&#062;<BR><BR>"<BR><BR> response.write "&#060;table border=1&#062;"<BR> for i = iRecFirstb To iRecLastb<BR> response.write "&#060;tr&#062;"<BR> for j = iFieldFirstb to iFieldLastb<BR> response.write "&#060;td&#062;" & countarray(j,i) & "&#060;/td&#062;"<BR> next<BR> response.write "&#060;/tr&#062;"<BR> next<BR> response.write "&#060;/table&#062;<BR><BR>"<BR><BR><BR>end function<BR><BR>%&#062;<BR><BR>&#060;/body&#062;<BR>&#060;/html&#062;

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•