# Sublists and lacing

I have a list of 20 doors and a second list of 2 doors that are also in the list of the 20 doors.
I want to create a list with true values for the 2 doors and keep the original list structure.

For some reason it works on 1 door but not on both… I’m 10000% sure that both doors should give a true value!

Try converting to an Element Id instead of the element itself. If nothing else this makes your manual check easier.

@jacob.small Element.Id is giving the same result…

Also I’m getting a wrong true value…
The values in sublist 15 are true in sublist 16… The comparison should only be within the same sublist…

@jacob.small I assume it has something to do with list levels and/or lacing. I’ve tried everything but I can’t seem to get it to work…

Did you Try to flatten before `==`?

2 Likes

Are your lists nested in a bigger list? Maybe you need to select the @@ setting in the == command. Also have you tried setting the == node to cross-lacing?

@Vikram_Subbaiah Seems almost the same, but my main list doesn’t have a @4 level, it has the same levels as the list with the items to check… And i need these same levels later on in the graph with a true/false value

It seems like you have an extra level sublists for your sublists, I don’t have that…

@Vikram_Subbaiah I looked at the info you’ve sent me but I still didn’t manage to solve this problem…

@_Vijay If I flatten I will lose the list structure…

@Daan I’ve tried every combination with the list levels. Cross lacing is not the solution, it will give too much true values since the doors are in multiple sublists. The combination == should only be within the same sublist…

Try to share the sample File so that we can experiment for your expected solution.

Not everything can be accomplished with list levels alone (depending on the list structure). Python is usually your best bet in these situations.

``````listA = IN[0]
listB = IN[1]
result = []

for subA,subB in zip(listA,listB):
out = []
for A in subA:
out.append(A in subB)
result.append(out)

OUT = result``````

See if this satisfies your requirement

`a<1><2> == b<1><1>;`

equals.dyn (9.6 KB)

@Vikram_Subbaiah Yes this works.
@Nick_Boyts Thanks, your python works a well

1 Like