I'm having trouble understanding what you are attempting. I think that maybe my problem is that your input and output sample has problems. For instance, in your input you have 20-1-763, but in your output list it says 20-7-763. Is that supposed to be a 7? Another problem that I think is a problem is that you list out only 4 records that have the first and third numbers the same; however, I see 6 records that should be a part of that set (5 of which are unique). Why do you say there are only 4 records that are the same? You see how your example might be confusing? Please give another example that shows the input data and also shows the output data. Be careful not to have any errors in your example because that is what I use to try to figure out what you are trying to do (black box approach).
What I am hearing you say is the following.
Find a record that has a unique third number and call it RecA.
Find a group of records that have both the first and third numbers the same and call that SetA.
For each number in SetA subtract its first column number from the first column number in record RecA.
If that result is between -6 and 6 (inclusively) then output that number (or put a 1 in the forth column?)
If this is what you want then there is one major issue that you must assure me will always occur? In order to do the above you can only have 1 record (and only 1 record) in your multidimensional array that has a unique third number. Also, you can only have 1 set (and only 1 set) that has both the third and forth numbers the same. For instance, you cannot have the following input list.
1-2-3
4-5-6
7-1-9
7-2-9
7-3-9
Because you have two records that have unique third numbers (records 1 and 2 both have unique third numbers).
You also cannot have the following input list.
1-2-3
4-1-6
4-2-6
4-3-6
7-1-9
7-2-9
7-3-9
Even though you have only one record with a unique third number (record 1 is the only record with a unique third number), you still have a problem with this input data because you have two sets of numbers that have the same first and third numbers (records 2, 3, and 4 in one set and records 5, 6, and 7 in the other set).
The way you worded your question and the example you gave does not make it clear how we are to attempt to handle these types of cases. So, I can only assume that you are assuring us that such cases can never happen. If that is true then I can solve this problem (provided you give me a better example).
Main Topics
Browse All Topics





by: Marv-inPosted on 2005-01-12 at 03:53:29ID: 13022864
here is a start:
sort your array by col 3
loop through with somthing like this:
for L = 0 to max step 2
if ary(L,L,L) = ary(L,L,L+1) then 'its not unique
next
sort the array by first and third
Loop through checking the 1st and 3rd for equality and the elemetns around it in the second level
What is this for? do you have to have the data in an array?