Question RE using Array Values in Case/If statements

Reply

Join Date: Apr 2008
Posts: 5
Reputation: Scott Marchione is an unknown quantity at this point 
Solved Threads: 0
Scott Marchione Scott Marchione is offline Offline
Newbie Poster

Question RE using Array Values in Case/If statements

 
0
  #1
Apr 25th, 2008
I have a VBS that I using to create a phone list..I've posted quite a few questions relating to it on these forumns, and have been getting some good feed back, so I thought I'd post one last question. I have a list of names that is pulled from my Active Directory, and I have found a way to alphabetize them (using a bubble sort). The names are in an array which I populated with only the first name and last name of the user, however my form is sorted by other attributes of the account...so question 1 is do I lose all the other attributes of the record that is being pulled when I place them in the array? and question 2 is how would I use the entries of the array in my if statement that is nested within a case statement?

Here is a sample of the code that I am using...

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. EnumerateUsers(oCont)
  2. Dim oUser
  3. Dim arrNames()
  4. intSize = 0
  5.  
  6. For Each oUser In oCont
  7.  
  8.  
  9. ' start bubble sort
  10. ReDim preserve arrNames(intsize)
  11. arrNames(intsize) = oUser.SN & ", " & oUser.GivenName
  12. intSize = intSize + 1
  13. Next
  14.  
  15. For i = (UBound(arrNames) - 1) to 0 Step -1
  16. For j= 0 to i
  17. If UCase(arrNames(j)) > UCase(arrNames(j+1)) Then
  18. strHolder = arrNames(j+1)
  19. arrNames(j+1)=arrNames(j)
  20. arrNames(j) = StrHolder
  21. End If
  22. Next
  23. 'end bubble sort, now all names are in alphabetical order by last name
  24.  
  25. Select Case LCase(oUser.Class)
  26. Case "user"
  27. If oUser.telephoneNumber <> "" then
  28. If oUser.physicalDeliveryOfficeName = "Wixom" then
  29.  
  30. If oUser.department = "Engineering" then
  31.  
  32. sdata = "<tr>"
  33. sdata = sdata & "<td class='list'>" & oUser.GivenName & " " & oUser.SN & "</td>"
  34. sdata = sdata & "<td class='list'>" & oUser.telephoneNumber & "</td>"
  35. sdata = sdata & "</tr>"
  36.  
  37. wixEng(wixEngRow) = sdata
  38. 'wixEngRow = wixEngRow
  39. wixEngRow = wixEngRow + 1
  40.  
  41. end if
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC