List of Excel rows (arrays). How to call column index with counter

Hi guys.
I have two lists of rows of excel.
I need to find out through while loop with 2 counters, if first element of list1(0)(counter1) = first element of list2(0)(counter2), somehow like this.
How can I upgrade list1(counter1)=list2(counter2) to check instead of the whole lists, just a first elements of them with current counters?
Thanks/

@Slavich
can you post some demo value lists and define the input / expected result on this? With this we can work out a better solution

@ppr, sure
List1{array1,array2,array3}
array1{a,b,c}
array2{c,d,e}

List2{array4,array5,array6}
array4{x,y,z}

The question is how to adress to first element of array - this case a,c,e

In a classical way you can iterate over the lists (For each) and
List1.ElementAt(iterationIdex)(0) should find every first element from the nested arrays e.g. array1,2,3…

In case you need more help then provide real demo data sample

@ppr, Yes you understood me right.
But I receive error: ‘Option strict On disallows late building’. See attached.


Sorry can’t provide you with data, because of privacy.

The problem is in syntax… It is not accepted by some reason…

Its probably a type conflict. Is resolvable once you provide more details to your variable types (lists, Dicts…)

I am trying to upload screen, but recieve error from the forum “The AWS Access Key Id you provided does not exist in our records.”

@Slavich
Is this scenario ok for you:

List1{array1,array2}
array1{a,b,c}
array2{c,d,e}

List2{array4,array5}
array4{a,g,h}
array5{x,y,z}
array2: c is not matching array5: x and info will be added on the dictionary

@ppr,
Yes, right!

Ok give me a little time I try to do a demo for you

@Slavich

Demo_NestedArrayMatch.xaml (7.8 KB)
Maybe Not the elegant way but the basics should work

Thank you, @ppr
It looks good, but I use while loop.


-This way it works.
But I need to call for each ‘list.array(0)’…
I tried with ListOLD.ElementAt(counterOLD)(0) - not compiles.
Any ideas how to arrange it in while loop?

I suggest to You to do it with for each. It is iterating for all List1 elements. Check this with an additional log message in the if then branch

1 Like

I’ve done it by implementing another two lists. But anyway, thank you for help!

@Slavich
Maybe you can avoid some not late binding issues by:

Changing the list type to List(Of Object()) then L1(0) returns an object array that you can access with e.g. L1(idx)(0)

Doinf or both list the DirectCast similar to grafik

then you can access as I have done in the If Statement

I already have a list of object. See in my variables.

@Slavich
Yes But I was talking about List(Of Object () ) A list of ObjectArray

System.Collections.Generic.ICollection<System.Object> - is this it?

A List Of Objects:
System.Collections.Generic.ICollection<System.Object>

A list Of Object Arrays: grafik

1 Like