![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Question About arrays I have a 2 Dimentional Array that is of size ArrayAD(1500,9). Basically I would like to loop through everything in the X axis and pull the results for that line into a string. Once I have this I would like to move to the next record. This is what I have come up with so far, it's super ugy. Is there a better way to do this? ax = UBound(ArrayAD,1) ay = UBound(ArrayAD,2) For x = 0 To ax tmpString = "" For y = 0 To ay ttmpString=tmpString & ArrayAD(x,y) & "|" Next wscript.echo tmpString Next |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Question About arrays "Bob Smith" <BobSmith@xxxxxx> wrote in message news:F1BF1A8C-3037-421B-A2E0-61409B4376B1@xxxxxx Quote: >I have a 2 Dimentional Array that is of size ArrayAD(1500,9). Basically I > would like to loop through everything in the X axis and pull the results > for > that line into a string. Once I have this I would like to move to the next > record. > > This is what I have come up with so far, it's super ugy. Is there a better > way to do this? > > ax = UBound(ArrayAD,1) > ay = UBound(ArrayAD,2) > > For x = 0 To ax > tmpString = "" > For y = 0 To ay > ttmpString=tmpString & ArrayAD(x,y) & "|" > Next > wscript.echo tmpString > Next For Each sElement in ArrayAD MsgBox sElement Next |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Question About arrays "James Whitlow" <jwhitlow.60372693@xxxxxx> wrote in message news:OylVRTFGJHA.2076@xxxxxx Quote: > "Bob Smith" <BobSmith@xxxxxx> wrote in message > news:F1BF1A8C-3037-421B-A2E0-61409B4376B1@xxxxxx Quote: >>I have a 2 Dimentional Array that is of size ArrayAD(1500,9). Basically I >> would like to loop through everything in the X axis and pull the results >> for >> that line into a string. Once I have this I would like to move to the >> next >> record. >> >> This is what I have come up with so far, it's super ugy. Is there a >> better >> way to do this? >> >> ax = UBound(ArrayAD,1) >> ay = UBound(ArrayAD,2) >> >> For x = 0 To ax >> tmpString = "" >> For y = 0 To ay >> ttmpString=tmpString & ArrayAD(x,y) & "|" >> Next >> wscript.echo tmpString >> Next > How about: > > For Each sElement in ArrayAD > MsgBox sElement > Next wscript.echo record), whereas, I think he wants to display each "row" of the array as a unit. Ideally, his inner loop should be replaced by a call to the "JOIN" function. Unfortunately, that function accepts a parameter of type array, whereas there is no syntactical way to refer to a row (or column) of a two dimensional array as if it were itself an array. The above may seem super ugly, but it will work. It might be possible to beautify that part of the code by restructuring the two dimensional rectangular array into a one-dimensional array whose elements are, themselves, one-dimensional arrays equivalent to the rows of the 2D array. While that might make this particular code less ugly, ir might require significant "uglification" elsewhere to accommodate the new data structure. /Al |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Comparing arrays | PowerShell | |||
| Arrays | PowerShell | |||
| Overwriting Arrays | PowerShell | |||
| Working with arrays | PowerShell | |||
| question about arrays | PowerShell | |||