ease20022002
Board Regular
- Joined
- Jun 4, 2005
- Messages
- 233
Hi Guys,
Say for example that I have nested loops based off of two variable arrays.
Say there are two values in the first array and nine values in the second array.
Say the first value needs to be "compared" with every value in the second array, but the second value of the first array only needs to be compared with the last three values of the second array.
I know how to setup a "static" loop:
This does get the job down with what I explained earlier, but what if the array changes, etc., and I decide to make this more of a dynamic array and 1 day the values in the first array need to be compared to different values in the second array...Is there a better way to set this up? Would a scripting dictionary approach be better, etc...
I welcome all comments and advice. I am just trying to think of ways to make this loop with the current array setup more dynamic...b.c if i change values in the arrays, or rearrange them, the loop will not work correctly.
The reason for this loop is to obtain data from a database. I can't simply have each All_Lines values be combined with All_Datatypes b.c I would be retrieving way too much data. We don't need each to be compared. What would be the best way to have selective comparrision between arrays, or dynamic...etc... If anyone still has anymore questions, please let me know..
I appreciate any help... [/code]
Say for example that I have nested loops based off of two variable arrays.
Say there are two values in the first array and nine values in the second array.
Say the first value needs to be "compared" with every value in the second array, but the second value of the first array only needs to be compared with the last three values of the second array.
Code:
All_Lines = Array("HO", "ALLD")
All_DataType = Array("CWTC", "CWTO", "CWTT", "DOMC", "DOMO", "DOMT", "CWXC", "CWXO", "CWXT")
I know how to setup a "static" loop:
Code:
For DLine = 0 To UBound(All_Lines)
For DType = 6 To UBound(All_DataType)
This does get the job down with what I explained earlier, but what if the array changes, etc., and I decide to make this more of a dynamic array and 1 day the values in the first array need to be compared to different values in the second array...Is there a better way to set this up? Would a scripting dictionary approach be better, etc...
I welcome all comments and advice. I am just trying to think of ways to make this loop with the current array setup more dynamic...b.c if i change values in the arrays, or rearrange them, the loop will not work correctly.
The reason for this loop is to obtain data from a database. I can't simply have each All_Lines values be combined with All_Datatypes b.c I would be retrieving way too much data. We don't need each to be compared. What would be the best way to have selective comparrision between arrays, or dynamic...etc... If anyone still has anymore questions, please let me know..
I appreciate any help... [/code]