Microsoft® Windows® 2000 Scripting Guide
« Previous | Next »
Arrays provide a quick and easy way to track one-dimensional data. When you have multidimensional data, however, it can become difficult to keep track of the various subscripts; it can also become exceedingly complex to try to sort the data. Because of that, if you do have multidimensional data you might want to consider one of the these alternatives:
For i = LBound(SampleArray) to UBound(SampleArray) For j = LBound(SampleArray) to UBound(SampleArray) If j = UBound(SampleArray) Then Else If SampleArray(j) > SampleArray(j + 1) Then TempValue = SampleArray(j + 1) SampleArray(j + 1) = SampleArray(j) SampleArray(j) = TempValue End If End If Next Next
By contrast, this single line of code sorts a disconnected recordset by field name (in this case, FileSize):
DisconnectedRecordset.Sort =
"FileSize
"
For more information about disconnected recordsets, see "Creating Enterprise Scripts" in this book.
Send us your feedback | « Previous | Next » |